internal

package module
v0.0.0-...-10fbe98 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

Loads a new session and creates all the commands

func Reload

func Reload(e fsnotify.Event)

Kills the current sessioon and tries to start a new one

func Run

func Run()

Runs dishook

Types

type WebhookArgument

type WebhookArgument struct {
	Name        string      `mapstructure:"name"`
	Desc        string      `mapstructure:"description"`
	Type        string      `mapstructure:"type"`
	Req         bool        `mapstructure:"required"`
	Default     interface{} `mapstructure:"default"`
	DiscordInfo bool        `mapstructure:"discord"`
}

Holds an argument for a webhook

type WebhookHeader

type WebhookHeader struct {
	Name  string `mapstructure:"name"`
	Value string `mapstructure:"value"`
}

Holds a header for a webhook

type WebhookSlashCommand

type WebhookSlashCommand struct {
	Name      string                         `mapstructure:"name"`
	Desc      string                         `mapstructure:"description"`
	Resp      string                         `mapstructure:"response"`
	RespCode  int                            `mapstructure:"response_code"`
	URL       string                         `mapstructure:"url"`
	Method    string                         `mapstructure:"method"`
	Headers   []WebhookHeader                `mapstructure:"headers"`
	SubCmd    map[string]WebhookSlashCommand `mapstructure:"subcommands"`
	SubCmdGrp map[string]WebhookSlashCommand `mapstructure:"subcommand_groups"`
	Arguments []WebhookArgument              `mapstructure:"arguments"`
	Data      map[string]interface{}         `mapstructure:"data"`
	// These fields are context specific
	CalledOptions []*discordgo.ApplicationCommandInteractionDataOption
	CalledUser    *discordgo.Member
}

Overall struct to hold webhook command data

func (WebhookSlashCommand) Handler

The actual function that gets called when a command is run Its a value receiver because it will add specific interaction context to the WebhookSlashCommand

func (*WebhookSlashCommand) Info

Returns a pointer to the information needed for discord to register the commands

Jump to

Keyboard shortcuts

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