discordgox

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 3 Imported by: 0

README

discordgox

discordgoの拡張機能を提供します。

主に関数を使ってそれぞれの構造体を作成する際に記述量を減らすことができます。

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Commands          = make([]*discordgo.ApplicationCommand, 0)
	CommandHandlers   = make(map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate))
	ComponentHandlers = make(map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate))
)

Functions

func AddCommand

func AddCommand(command *discordgo.ApplicationCommand, fn func(s *discordgo.Session, i *discordgo.InteractionCreate))

func AddCommandWithComponent

func AddCommandWithComponent(
	cmd *discordgo.ApplicationCommand,
	cmdfn func(s *discordgo.Session, i *discordgo.InteractionCreate),
	customID string,
	cpnfn func(s *discordgo.Session, i *discordgo.InteractionCreate),
)

func AddComponent

func AddComponent(customID string, fn func(s *discordgo.Session, i *discordgo.InteractionCreate))

func NewActionsRow

func NewActionsRow(options ...ActionsRowOption) *discordgo.ActionsRow

func NewInteractionResponse

func NewInteractionResponse(options ...InteractionResponseOption) *discordgo.InteractionResponse

func NewList

func NewList[T any](t ...T) []T

あらゆる型の変数を引数に取って配列を返すメソッド interfaceの型が必要な場合はインスタンス化するためのかっこの中に型を指定する

func NewMessageEmbed

func NewMessageEmbed(options ...MessageEmbedOption) *discordgo.MessageEmbed

func NewMessageEmbedField

func NewMessageEmbedField(options ...MessageEmbedFieldOption) *discordgo.MessageEmbedField

func NewSelectMenuOption

func NewSelectMenuOption(label string, value string, options ...SelectMenuOptionOption) *discordgo.SelectMenuOption

Types

type ActionsRowOption

type ActionsRowOption func(*discordgo.ActionsRow)

MessageComponent構造体初期化のためのOptionと関数

func SetCustomButton added in v0.0.3

func SetCustomButton(style discordgo.ButtonStyle, label string, customID string) ActionsRowOption

func SetLinkButton added in v0.0.3

func SetLinkButton(label string, url string) ActionsRowOption

func SetMultiSelectMenu added in v0.0.3

func SetMultiSelectMenu(customID string, selectOptions []discordgo.SelectMenuOption, min_value *int, max_value int, placeholder string) ActionsRowOption

func SetSingleSelectMenu added in v0.0.3

func SetSingleSelectMenu(customID string, selectOptions []discordgo.SelectMenuOption, placeholder string) ActionsRowOption

type InteractionResponseOption

type InteractionResponseOption func(r *discordgo.InteractionResponse)

以下Option型と構造体生成関数の記述 InteractionResponse構造体の初期化のためのOptionと関数

type InteractionRsponseDataOption

type InteractionRsponseDataOption func(rd *discordgo.InteractionResponseData)

InteractionResponseData構造体の初期化のためのOptionと関数

func SetContent

func SetContent(content string) InteractionRsponseDataOption

type MessageEmbedFieldOption

type MessageEmbedFieldOption func(ef *discordgo.MessageEmbedField)

MessageEmbedField構造体の初期化のためのOptionと関数

func SetEmbedFieldInline

func SetEmbedFieldInline(b bool) MessageEmbedFieldOption

func SetEmbedFieldName

func SetEmbedFieldName(s string) MessageEmbedFieldOption

func SetEmbedFieldValue

func SetEmbedFieldValue(s string) MessageEmbedFieldOption

type MessageEmbedOption

type MessageEmbedOption func(e *discordgo.MessageEmbed)

MessageEmbed構造体の初期化のためのOptionと関数

func SetColor

func SetColor(i int) MessageEmbedOption

colorは16進数で指定する

func SetDescription

func SetDescription(s string) MessageEmbedOption

func SetEmbedAuthor added in v0.0.4

func SetEmbedAuthor(name, url, iconURL string) MessageEmbedOption

func SetTitle

func SetTitle(s string) MessageEmbedOption

type SelectMenuOptionOption

type SelectMenuOptionOption func(*discordgo.SelectMenuOption)

SelectMenuOption構造体初期化のためのOptionと関数

func SetSelectCustomEmoji added in v0.0.3

func SetSelectCustomEmoji(s string, id string) SelectMenuOptionOption

func SetSelectDefaultEmoji added in v0.0.3

func SetSelectDefaultEmoji(s string) SelectMenuOptionOption

func SetSelectDescription added in v0.0.3

func SetSelectDescription(d string) SelectMenuOptionOption

Jump to

Keyboard shortcuts

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