mtn_go_discord_framework

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EphemeralFlag = 64
)

Variables

This section is empty.

Functions

func BusySleep

func BusySleep()

busySleep pauses execution for up to 10 seconds if the system is busy

func CheckForRoles

func CheckForRoles(s *discordgo.Session, i *discordgo.InteractionCreate, roles ...string) bool

checkForRoles checks if a member has one of the provided roles

func InitFramework

func InitFramework(debugMode bool, testingGuildId string, botToken string) *discordgo.Session

Initializes the framework and returns a discord session, needed for the other functions

func RegisterButtonHandlerWithFramework

func RegisterButtonHandlerWithFramework(handler ButtonHandler)

Registers a button handler with the framework

func RegisterButtonHandlersWithFramework added in v0.1.3

func RegisterButtonHandlersWithFramework(handlers []ButtonHandler)

Registers multiple button handlers with the framework

func RegisterSlashCommandWithFramework

func RegisterSlashCommandWithFramework(command SlashCommand)

Registers a slash command with the framework

func RegisterSlashCommandsWithFramework added in v0.1.3

func RegisterSlashCommandsWithFramework(commands []SlashCommand)

Registers multiple slash commands with the framework

func ReleaseSystem

func ReleaseSystem()

Set systemBusy to false. Should be deferred after a successful tryAcquireSystem.

func SendDeferResponse

func SendDeferResponse(s *discordgo.Session, i *discordgo.InteractionCreate)

sendDeferResponse sends a deferred response to an interaction

func SendEphemeralEmbed added in v0.1.4

func SendEphemeralEmbed(s *discordgo.Session, i *discordgo.InteractionCreate, embed *discordgo.MessageEmbed)

func SendEphemeralResponse

func SendEphemeralResponse(s *discordgo.Session, i *discordgo.InteractionCreate, msg string)

sendEphemeralResponse sends a response to an interaction that only the user can see

func ShutdownFramework

func ShutdownFramework()

Shuts down the framework and closes the discord session

func StartFramework

func StartFramework()

Launches the framework and registers all commands and handlers

func TryAcquireSystem

func TryAcquireSystem() bool

Check if the system is busy. If not, set it to busy and return true. If it is busy, return false.

Types

type ButtonHandler

type ButtonHandler struct {
	CustomID string
	Handler  func(s *discordgo.Session, i *discordgo.InteractionCreate, args ...string)
}

type SlashCommand added in v0.1.4

type SlashCommand struct {
	discordgo.ApplicationCommand
	Handler func(s *discordgo.Session, i *discordgo.InteractionCreate, args ...string)
}

Jump to

Keyboard shortcuts

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