db

package
v0.0.0-...-926d86b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigKeyDiscordAPIToken     configKey = "discordapitoken"
	ConfigKeyGiveawayChannelID   configKey = "giveawaychannelid"
	ConfigKeyGiveawayGuildlID    configKey = "giveawayguildid"
	ConfigKeyGiveawayOrganiserID configKey = "giveawayorganiserid"
	ConfigKeyGiveawayRoleID      configKey = "giveawayroleid"
)

Variables

View Source
var Config = map[configKey]string{}

Functions

func GetPastWinnerIDs

func GetPastWinnerIDs() (pastWinnerIDs []string, err error)

func LoadConfig

func LoadConfig() (err error)

Types

type ConfigItem

type ConfigItem struct {
	ID    string
	Value string
}

type Event

type Event struct {
	CreatorID          string
	ID                 string
	Name               string
	ScheduledEndTime   time.Time
	ScheduledStartTime time.Time
	Status             discordgo.GuildScheduledEventStatus
	TriggersRaffle     bool
}

func GetEventByID

func GetEventByID(ID string) (event *Event, err error)

func NewEventFromDiscordEvent

func NewEventFromDiscordEvent(dcEvent *discordgo.GuildScheduledEvent) (event *Event)

func (*Event) Upsert

func (event *Event) Upsert() (err error)

type Participant

type Participant struct {
	ID       string
	Username string
}

func NewParticipantFromDiscordUser

func NewParticipantFromDiscordUser(dcUser *discordgo.User) (participant *Participant)

func (*Participant) Upsert

func (participant *Participant) Upsert() (err error)

type Prize

type Prize struct {
	EventID  string
	ID       string
	Name     string
	WinnerID string
}

func GetAvailablePrizes

func GetAvailablePrizes() (prizes []Prize, err error)

func GetPrizeSelectedForEvent

func GetPrizeSelectedForEvent(eventID string) (prize *Prize, err error)

func NewPrize

func NewPrize(name string) (prize *Prize)

func (*Prize) AssignEvent

func (prize *Prize) AssignEvent(eventID string) (err error)

func (*Prize) AssignWinner

func (prize *Prize) AssignWinner(winnerID string) (err error)

func (*Prize) Insert

func (prize *Prize) Insert()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL