interactor

package
v1.2.1-0...-60470b3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorPrimary   = 52421
	ColorSecondary = 7895160
	ColorError     = 12845056
	ColorWarning   = 13936130
	ColorSuccess   = 4434775
)

Variables

View Source
var Module = core.Module{
	Name: "Interactor",
	OnInit: func() {
		log.Println("Setting up Interactor")

		discord.Discord.AddHandler(interactionHandler)
	},
}

Functions

func MakeModal

func MakeModal(modal *Modal) *discordgo.InteractionResponse

func RegisterCommand

func RegisterCommand(cmd Command, perms *CommandPermissions) (err error)

func RegisterMessageComponent

func RegisterMessageComponent(cmp MessageComponent) error

func RegisterMessageComponents

func RegisterMessageComponents(cmps ...MessageComponent) error

func RegisterModal

func RegisterModal(options *ModalOptions) error

func RegisterModals

func RegisterModals(options ...*ModalOptions) error

Types

type ButtonOptions

type ButtonOptions struct {
	ComponentID string
	Callback    any

	Label string
	Style discordgo.ButtonStyle
	Emoji discordgo.ComponentEmoji
}

type Command

type Command interface {
	// contains filtered or unexported methods
}

type CommandContext

type CommandContext struct {
	Context
	Data *discordgo.ApplicationCommandInteractionData
}

type CommandOptions

type CommandOptions interface {
	// contains filtered or unexported methods
}

type CommandPermissions

type CommandPermissions struct {
	DefaultMemberPermissions *int64
	DMPermission             *bool
	NSFW                     *bool
}

type Context

type Context struct {
	Session     *discordgo.Session
	Interaction *discordgo.Interaction
}

func (*Context) ModalRespond

func (c *Context) ModalRespond(modal *Modal) error

func (*Context) Respond

func (c *Context) Respond(resp *discordgo.InteractionResponse) error

func (*Context) UpsertRespond

func (c *Context) UpsertRespond(data *discordgo.InteractionResponseData) error

type MemberCommand

type MemberCommand struct {
	Name              string
	NameLocalizations *map[discordgo.Locale]string
	Callback          any
}

type Mentionable

type Mentionable struct {
	// contains filtered or unexported fields
}

func (*Mentionable) Member

func (m *Mentionable) Member() (*discordgo.Member, bool)

func (*Mentionable) Role

func (m *Mentionable) Role() (*discordgo.Role, bool)

func (*Mentionable) User

func (m *Mentionable) User() (*discordgo.User, bool)

type MessageCommand

type MessageCommand struct {
	Name              string
	NameLocalizations *map[discordgo.Locale]string
	Callback          any
}

type MessageComponent

type MessageComponent interface {
	// contains filtered or unexported methods
}

type MessageComponentContext

type MessageComponentContext struct {
	Context
	Data *discordgo.MessageComponentInteractionData
	ID   string
}

type MessageComponentOptions

type MessageComponentOptions struct {
	ComponentID string
	ID          string
	Disabled    bool
}
type Modal struct {
	ModalID string
	ID      string
	Title   string
	Values  any
}

type ModalContext

type ModalContext struct {
	Context
	Data *discordgo.ModalSubmitInteractionData
	ID   string
}

type ModalOptions

type ModalOptions struct {
	ModalID  string
	Title    string
	Callback any
}

type SelectMenuOptions

type SelectMenuOptions struct {
	ComponentID string
	Callback    any

	Placeholder  string
	MinValues    *int
	MaxValues    int
	Options      []discordgo.SelectMenuOption
	ChannelTypes []discordgo.ChannelType
}

type SlashCommand

type SlashCommand struct {
	Name                     string
	NameLocalizations        *map[discordgo.Locale]string
	Description              string
	DescriptionLocalizations *map[discordgo.Locale]string
	Callback                 any
}

type SlashCommandGroup

type SlashCommandGroup struct {
	Name                     string
	NameLocalizations        *map[discordgo.Locale]string
	Description              string
	DescriptionLocalizations *map[discordgo.Locale]string
	SubCommands              []CommandOptions
}

Jump to

Keyboard shortcuts

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