discord

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SlashCommands = []*discordgo.ApplicationCommand{
		{
			Name:        "lemokon",
			Description: "Configure LemoKon (Discord Kon)",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionSubCommand,
					Name:        "summon",
					Description: "Register this channel as the destination of bot messages",
				},
			},
		},
	}

	CommandsHandler = func(s *discordgo.Session, i *discordgo.InteractionCreate) {
		switch i.Data.Name {
		case "lemokon":
			switch i.Data.Options[0].Name {
			case "summon":
				if err := Options.SetChannelID(i.ChannelID); err != nil {
					respond(s, i, "Failed to set this channel as the destination of bot messages.")
					fmt.Printf("Failed to update options.ChannelID: %s\n", err)
					return
				}
				respond(s, i, "Successfully configured this channel as the destination of bot messages.")
				return
			}
		}

		respond(s, i, "Unknown command received.")
	}
)
View Source
var (
	Options = &DiscordKonOptions{}
)

Functions

func GetRecordingMessageID

func GetRecordingMessageID(recordingID int) (string, string, error)

func SaveRecordingMessageID

func SaveRecordingMessageID(recordingID int, channelID string, messageID string) error

Types

type DiscordKonOptions

type DiscordKonOptions struct {
	Uniq      bool `gorm:"primaryKey"`
	ChannelID string
}

func (*DiscordKonOptions) Load

func (o *DiscordKonOptions) Load() error

func (*DiscordKonOptions) SetChannelID

func (o *DiscordKonOptions) SetChannelID(channelID string) error

func (DiscordKonOptions) TableName

func (DiscordKonOptions) TableName() string

type DiscordRecording

type DiscordRecording struct {
	RecordingID int `gorm:"primaryKey"`
	ChannelID   string
	MessageID   string
}

Jump to

Keyboard shortcuts

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