rsvp

package
v2.33.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventAccepted  = "event_accepted"
	EventRejected  = "event_rejected"
	EventWaitlist  = "event_waitlist"
	EventUndecided = "event_undecided"
)
View Source
const (
	EmojiJoining    = "✓"
	EmojiMaybe      = "❔"
	EmojiNotJoining = "X"
	EmojiWaitlist   = "🕐"
)

Variables

View Source
var DBSchemas = []string{`
CREATE TABLE IF NOT EXISTS rsvp_sessions (
	message_id BIGINT PRIMARY KEY,

	guild_id BIGINT NOT NULL,
	channel_id BIGINT NOT NULL,
	local_id BIGINT NOT NULL,
	author_id BIGINT NOT NULL,

	created_at TIMESTAMP WITH TIME ZONE NOT NULL,
	starts_at TIMESTAMP WITH TIME ZONE NOT NULL,

	title TEXT NOT NULL,
	description TEXT NOT NULL,
	max_participants INT NOT NULL,

	send_reminders BOOLEAN NOT NULL,
	sent_reminders BOOLEAN NOT NULL
);
`, `
CREATE TABLE IF NOT EXISTS rsvp_participants (
	user_id BIGINT NOT NULL,
	rsvp_sessions_message_id BIGINT NOT NULL REFERENCES rsvp_sessions(message_id) ON DELETE CASCADE,

	guild_id BIGINT NOT NULL,

	join_state SMALLINT NOT NULL,
	reminder_enabled BOOLEAN NOT NULL,
	marked_as_participating_at TIMESTAMP WITH TIME ZONE NOT NULL,

	PRIMARY KEY(rsvp_sessions_message_id, user_id)
);
`}
View Source
var UTCRegex = regexp.MustCompile(`(?i)\butc\b`)

Functions

func NextUpdateTime

func NextUpdateTime(m *models.RSVPSession) time.Time

func ParticipantField

func ParticipantField(state ParticipantState, participants []*models.RSVPParticipant, users []*dstate.MemberState, name string) *discordgo.MessageEmbedField

func RegisterPlugin

func RegisterPlugin()

func UpdateEventEmbed

func UpdateEventEmbed(m *models.RSVPSession) error

Types

type ParticipantState

type ParticipantState int16
const (
	ParticipantStateJoining    ParticipantState = 1
	ParticipantStateMaybe      ParticipantState = 2
	ParticipantStateNotJoining ParticipantState = 3
	ParticipantStateWaitlist   ParticipantState = 4
)

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) AddCommands

func (p *Plugin) AddCommands()

func (*Plugin) BotInit

func (p *Plugin) BotInit()

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

type RolesRunFunc

type RolesRunFunc func(gs *dstate.GuildSet) ([]int64, error)

type SetupSession

type SetupSession struct {
	CreatedOnMessageID int64
	GuildID            int64
	AuthorID           int64
	SetupChannel       int64

	State SetupState

	MaxParticipants int
	Title           string
	Channel         int64
	When            time.Time

	LastAction time.Time
	// contains filtered or unexported fields
}

func (*SetupSession) Finish

func (s *SetupSession) Finish()

type SetupState

type SetupState int
const (
	SetupStateChannel SetupState = iota
	SetupStateTitle
	SetupStateMaxParticipants
	SetupStateWhen
	SetupStateWhenConfirm
)

type UpdatingSession

type UpdatingSession struct {
	ID      int64
	GuildID int64
	// contains filtered or unexported fields
}

Spam update protection, forces 5 seconds between each update

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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