utils

package
v0.0.0-...-d4a2531 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditResponseWithString

func EditResponseWithString(s *discord.Session, i *discord.InteractionCreate, message string)

func GenericRandomVoiceCommandHandler

func GenericRandomVoiceCommandHandler(dirpath string) func(s *discord.Session, i *discord.InteractionCreate)

func GenericVoiceCommandHandler

func GenericVoiceCommandHandler(filepath string) func(s *discord.Session, i *discord.InteractionCreate)

func GetInteractionVoiceChannelID

func GetInteractionVoiceChannelID(s *discord.Session, i *discord.InteractionCreate) (string, error)

func LoadOpusFile

func LoadOpusFile(filepath string, buffer *[][]byte) error

func PickRandomFileFromDirectory

func PickRandomFileFromDirectory(dirpath string) (string, error)

func PlayAudio

func PlayAudio(s *discord.Session, guildID string, channelID string, buffer [][]byte) error

func RespondToInteractionCreateWithString

func RespondToInteractionCreateWithString(s *discord.Session, i *discord.InteractionCreate, message string)

func SaveGuildToDB

func SaveGuildToDB(guildData *Guild) error

func SaveUserToDB

func SaveUserToDB(userData *User) error

Types

type Guild

type Guild struct {
	ID             uint
	DiscordGuildID string
	Greeting       bool
	Birthday       bool
	DMOnMention    bool
}

func LoadGuildFromDBByID

func LoadGuildFromDBByID(guildID string) (*Guild, error)

type SlashCommand

type SlashCommand struct {
	CommandData    *discord.ApplicationCommand
	CommandHandler func(*discord.Session, *discord.InteractionCreate)
}

func GenericRandomVoiceCommand

func GenericRandomVoiceCommand(name, descriprion, dirpath string) SlashCommand

func GenericVoiceCommand

func GenericVoiceCommand(name, description, filepath string) SlashCommand

type User

type User struct {
	ID                       uint
	DiscordUserID            string
	DiscordGuildID           string
	GreetingEnabled          bool
	GreetingUnixTimestamp    int64
	BirthdayDate             string // In MM/DD format
	LastBirthdayGreetingYear int
}

func LoadUserFromDBByID

func LoadUserFromDBByID(userID string) (*User, error)

Jump to

Keyboard shortcuts

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