slashlib

package module
v1.0.0 Latest Latest
Warning

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

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

README

slashlib

開発環境 : go version go1.17.8 linux/arm64 raspi4 8GB

Documentation

Index

Constants

View Source
const Invisible uint64 = 1 << 6

InteractionResponseのFlag

Variables

This section is empty.

Functions

func CommandDelete

func CommandDelete(discord *discordgo.Session, guildID string, name string) error

Command削除 all guild when guildID == ""

func FindValue

func FindValue(interaction *discordgo.InteractionCreate, key string) (value []interface{})

Types

type Command

type Command struct {
	Discord []*discordgo.ApplicationCommand
	// contains filtered or unexported fields
}

チェーンメゾット用の型

func (*Command) AddChoice

func (c *Command) AddChoice(name string, value interface{}) *Command

コマンドの選択を追加 max 25 Choices

func (*Command) AddCommand

func (c *Command) AddCommand(cmd, description string, perm int64) *Command

コマンド生成 perm is command run user permission by https://github.com/bwmarrin/discordgo/blob/v0.27.1/structs.go#L2092-L2179

func (*Command) AddOption

func (c *Command) AddOption(ops *discordgo.ApplicationCommandOption) *Command

コマンドのオプションの追加 how to use Minvalue,MinLength x :=1.1 ops.MinValue = &x

func (*Command) CommandCreate

func (c *Command) CommandCreate(discord *discordgo.Session, guildID string)

Command生成 all guild when guildID == ""

func (*Command) CommandLast

func (c *Command) CommandLast() int

Command[-1] 参照用

func (*Command) OptionsLast

func (c *Command) OptionsLast() int

Command[-1].Options[-1] 参照用

type CommandType

type CommandType int8

返すタイプ

const (
	// Slash Command (MessageCommand)
	SlashCommand CommandType = 1
	// Comporment Command (MessageComponent)
	ComponentCommand CommandType = 2
	// Submit (ModalSubmit)
	SubmitCommand CommandType = 3
)

type Component

type Component struct {
	Discord []discordgo.ActionsRow
}

チェーンメゾット用の型

func (*Component) AddButton

func (c *Component) AddButton(data discordgo.Button) *Component

ボタンの追加 Request: Label, Style. if Style:5 => Request: URL unles Style:5 => Request: "CustomID" max 5 buttons in 1line

func (*Component) AddInput

func (c *Component) AddInput(data discordgo.TextInput) *Component

入力の追加 FuncReq: AddLine() Request: CustomID,Label,Style. Styles : discordgo.TextInputShort,discordgo.TextInputParagraph,. Interaction Response Only

func (*Component) AddLine

func (c *Component) AddLine() *Component

行の追加 pls before run AddButton,AddMenu or AddInput

func (*Component) AddSelectMenu

func (c *Component) AddSelectMenu(data discordgo.SelectMenu) *Component

選択メニューの追加 FuncReq: AddLine() Request: CustomID, Options. SelectMenuOption Request: Label,Value. if MinValue or MaxValue != 0 multi select

func (*Component) CompArrayLast

func (c *Component) CompArrayLast(n int) int

Componentの最後の要素 参照用

func (*Component) Parse

func (c *Component) Parse() (result []discordgo.MessageComponent)

Componentをdiscordgoで使えるように

type InteractionResponse

type InteractionResponse struct {
	Discord     *discordgo.Session
	Interaction *discordgo.Interaction
	Response    *discordgo.InteractionResponse
}

チェーンメゾット用の型

func (*InteractionResponse) Edit

Interaction Edit Message

func (*InteractionResponse) Follow

Interaction FollowUP Message Flags Usual: Invisible

func (*InteractionResponse) Reply

Interaction Reply Message Flags Usual: Invisible

func (*InteractionResponse) Thinking

func (i *InteractionResponse) Thinking(invisible bool) error

Interaction Thinking Message Please after Follow()

func (*InteractionResponse) Window

func (i *InteractionResponse) Window(title, customID string, comp *Component) error

Interaction Window Message Component doesn't usual: AddButton(),AddMenu Result Type is Submit

type InteractionStruct

type InteractionStruct struct {
	GuildID        string
	GuildName      string
	GuildData      *discordgo.Guild
	ChannelID      string
	ChannelName    string
	ChannelData    *discordgo.Channel
	UserID         string
	UserNum        string
	UserName       string
	UserData       *discordgo.User
	Type           discordgo.InteractionType
	Check          CommandType
	Command        discordgo.ApplicationCommandInteractionData
	CommandOptions map[string]OptionData
	Component      discordgo.MessageComponentInteractionData
	Submit         discordgo.ModalSubmitInteractionData
	PostData       []PostData
	FormatText     string
}

整形用構造体

func InteractionViewAndEdit

func InteractionViewAndEdit(discord *discordgo.Session, i *discordgo.InteractionCreate) (iData InteractionStruct)

InteractionCreate 整形

type OptionData

SlashCommandのOptionデータ

func (OptionData) AttachmentValue

func (data OptionData) AttachmentValue(i InteractionStruct) *discordgo.MessageAttachment

discordgoにないデータ

type OptionType

type OptionType int8

Optionタイプ

const (
	// String
	TypeString OptionType = 3
	// Int
	TypeInt OptionType = 4
	// Bool
	TypeBool OptionType = 5
	// @User
	TypeUser OptionType = 6
	// #Channnel
	TypeChannel OptionType = 7
	// @Role
	TypeRole OptionType = 8
	// Mentionable (@User,@Role)
	TypeMention OptionType = 9
	// Float
	TypeFloat OptionType = 10
	// Files
	TypeFile OptionType = 11
)

type PostData

type PostData struct {
	CustomID string
	Value    string
}

Submitのデータ

type ReturnType

type ReturnType int8

返すタイプ

const (
	// Reply for Message
	ReplyMessage ReturnType = 4
	// Reply for Thiking
	// pls leter Edit()
	ReplyThiking ReturnType = 5
	// Interaction In Modal Window
	Window ReturnType = 9
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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