commands

package
v0.0.0-...-37b14fa Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SlashCommands         []*discordgo.ApplicationCommand
	SlashCommandsHandlers = make(map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate))
	CommandMap            = make(map[string]*Command)
)
View Source
var DailyScheduleEventsBlock events.Block
View Source
var Today = &SafeTime{Time: time.Now()}

Functions

func Add

func Add(c *Command)

func AnimeSubsTimer

func AnimeSubsTimer(_ *discordgo.Session, _ *discordgo.Ready)

func AnimeSubsWebhookTimer

func AnimeSubsWebhookTimer(_ *discordgo.Session, _ *discordgo.Ready)

func AnimeSubsWebhooksMapTimer

func AnimeSubsWebhooksMapTimer(_ *discordgo.Session, _ *discordgo.Ready)

func DailySchedule

func DailySchedule(s *discordgo.Session, guildID string)

DailySchedule posts the schedule in a target channel if a guild has enabled it

func DailyScheduleWebhook

func DailyScheduleWebhook(s *discordgo.Session, guildID string)

TODO: DailyScheduleWebhook posts the schedule in a target channel if a guild has enabled it via webhook

func DailyStatsTimer

func DailyStatsTimer(_ *discordgo.Session, e *discordgo.Ready)

func DonghuaCommandHandler

func DonghuaCommandHandler(s *discordgo.Session, m *discordgo.Message)

DonghuaCommandHandler handles donghua disable or enable

func HandleCommand

func HandleCommand(s *discordgo.Session, m *discordgo.MessageCreate)

HandleCommand handles the incoming message

func IsValidSlashCommand

func IsValidSlashCommand(s *discordgo.Session, cmdTrigger, authorID, guildID string) bool

func RaffleReactJoinHandler

func RaffleReactJoinHandler(s *discordgo.Session, r *discordgo.MessageReactionAdd)

RaffleReactJoinHandler enters a user in a raffle if they react

func RaffleReactLeaveHandler

func RaffleReactLeaveHandler(s *discordgo.Session, r *discordgo.MessageReactionRemove)

RaffleReactLeaveHandler removes a user from a raffle if they unreact

func ReactJoinHandler

func ReactJoinHandler(s *discordgo.Session, r *discordgo.MessageReactionAdd)

ReactJoinHandler gives a specific role to a user if they react

func ReactRemoveHandler

func ReactRemoveHandler(s *discordgo.Session, r *discordgo.MessageReactionRemove)

ReactRemoveHandler removes a role from user if they unreact

func RegisterSlashCommands

func RegisterSlashCommands(_ *discordgo.Session, _ *discordgo.Ready)

func ResetSubscriptions

func ResetSubscriptions()

ResetSubscriptions Resets anime sub notifications status

func SaveReactJoin

func SaveReactJoin(messageID string, role string, emoji string, guildID string)

SaveReactJoin saves the react channel join and parses if it already exists

func ScheduleTimer

func ScheduleTimer(_ *discordgo.Session, _ *discordgo.Ready)

func UpdateAnimeSchedule

func UpdateAnimeSchedule()

UpdateAnimeSchedule fetches animeschedule.net timetable

func VerifySlashCommand

func VerifySlashCommand(s *discordgo.Session, cmdTrigger string, i *discordgo.InteractionCreate) error

func WebhooksMapHandler

func WebhooksMapHandler()

WebhooksMapHandler updates the anime subs guilds' webhooks map

Types

type Command

type Command struct {
	Execute     func(*discordgo.Session, *discordgo.Message)
	Name        string
	Aliases     []string
	Desc        string
	DeleteAfter bool
	Permission  functionality.Permission
	Module      string
	DMAble      bool
	Options     []*discordgo.ApplicationCommandOption
	Handler     func(s *discordgo.Session, i *discordgo.InteractionCreate)
}

type Joke

type Joke struct {
	ID        int    `json:"id"`
	JokeType  string `json:"type"`
	Setup     string `json:"setup"`
	Punchline string `json:"punchline"`
}

type SafeTime

type SafeTime struct {
	deadlock.RWMutex
	Time time.Time
}

Jump to

Keyboard shortcuts

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