disgord

package module
v0.0.0-...-dac1f72 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const Invisible uint64 = 1 << 6

InteractionResponseのFlag

Variables

This section is empty.

Functions

func ComponentParse

func ComponentParse(lines ...*ComponentLine) (result []discordgo.MessageComponent)

Componentをdiscordgoで使えるように

func FindValue

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

func GetUserVoiceState

func GetUserVoiceState(discord *discordgo.Session, userID string) *discordgo.VoiceState

func HaveRole

func HaveRole(discord *discordgo.Session, guildID, userID, roleID string) (have bool, err error)

func InteractionCommandCreate

func InteractionCommandCreate(discord *discordgo.Session, guildID string, commands []*discordgo.ApplicationCommand)

Command生成 all guild when guildID == ""

func InteractionCommandDelete

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

Command削除 all guild when guildID == ""

func JoinUserVCchannel

func JoinUserVCchannel(discord *discordgo.Session, userID string, micMute, speakerMute bool) (vc *discordgo.VoiceConnection, err error)

func NewFileEncodeStream

func NewFileEncodeStream(v *discordgo.VoiceConnection, f string, opts EncodeOpts, done chan error) (s *encodeSession)

func NewMemEncodeStream

func NewMemEncodeStream(v *discordgo.VoiceConnection, r io.Reader, opts EncodeOpts, done chan error) (s *encodeSession)

func PlayAudioFile

func PlayAudioFile(vcSession *discordgo.VoiceConnection, filename string, speed float64, pitch float64, volume float64, isPlayback bool, end <-chan bool) error

音再生 end := make(<-chan bool, 1)

Types

type ApplicationCommandOptions

type ApplicationCommandOptions struct {
	*discordgo.ApplicationCommandInteractionDataOption
}

func (ApplicationCommandOptions) AttachmentValue

discordgo unsupported Attachments

type ComponentLine

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

func ComponentNewLine

func ComponentNewLine() *ComponentLine

func (*ComponentLine) Button

func (cl *ComponentLine) Button(button discordgo.Button) *ComponentLine

if Style:5 => Request: URL unles Style:5 => Request: "CustomID" max 5 buttons in 1line Request: Label, Style.

func (*ComponentLine) Input

func (cl *ComponentLine) Input(textInput discordgo.TextInput) *ComponentLine

FuncReq: AddLine() Request: CustomID,Label,Style. Styles : discordgo.TextInputShort,discordgo.TextInputParagraph,. Interaction Response Only

func (*ComponentLine) SelectMenu

func (cl *ComponentLine) SelectMenu(selectMenu discordgo.SelectMenu) *ComponentLine

FuncReq: AddLine() Request: CustomID, Options. SelectMenuOption Request: Label,Value. if MinValue or MaxValue != 0 multi select

type EncodeOpts

type EncodeOpts struct {
	FlameBuf    int     // default 100(20ms*100=2s)
	Offset      float64 // encode start time
	AudioFilter string  // ffmpeg Filters,https://ffmpeg.org/ffmpeg-filters.html#Audio-Filters
	Compression int     //higher is best quality & slow encoding(0-10)
}

FFmpeg Options

type EncodeStats

type EncodeStats struct {
	Size    int
	Time    time.Duration
	Bitrate float32
	Speed   float32
}

type InteractionData

type InteractionData struct {
	GuildID   string
	Guild     *discordgo.Guild
	ChannelID string
	Channel   *discordgo.Channel
	User      *discordgo.User

	InteractionType discordgo.InteractionType
	Command         discordgo.ApplicationCommandInteractionData
	CommandOptions  map[string]ApplicationCommandOptions
	Component       discordgo.MessageComponentInteractionData
	Modal           discordgo.ModalSubmitInteractionData
	ModalValues     map[string]string

	FormatText string
}

func InteractionParse

func InteractionParse(discord *discordgo.Session, i *discordgo.Interaction) (id InteractionData)

type InteractionResponse

type InteractionResponse struct {
	Response *discordgo.InteractionResponse
	// contains filtered or unexported fields
}

func NewInteractionResponse

func NewInteractionResponse(d *discordgo.Session, i *discordgo.Interaction) (ir *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(isInvisible bool) error

Interaction Thinking Message Please after Follow()

func (*InteractionResponse) Window

func (i *InteractionResponse) Window(title, customID string, comps ...*ComponentLine) error

Interaction Window Message Component only usual: Input#string

type MessageData

type MessageData struct {
	GuildID   string
	Guild     *discordgo.Guild
	ChannelID string
	Channel   *discordgo.Channel
	User      *discordgo.User

	MessageID string
	Message   *discordgo.Message

	FormatText string
}

func MessageParse

func MessageParse(discord *discordgo.Session, m *discordgo.Message) (md MessageData)

type ReactionData

type ReactionData struct {
	GuildID   string
	Guild     *discordgo.Guild
	ChannelID string
	Channel   *discordgo.Channel
	User      *discordgo.User

	MessageID string
	Message   *discordgo.Message

	Emoji     discordgo.Emoji
	EmojiIcon string

	FormatText string
}

func ReactionParse

func ReactionParse(discord *discordgo.Session, r *discordgo.MessageReaction, eventName string) (rd ReactionData)

type VoiceStateData

type VoiceStateData struct {
	GuildID   string
	Guild     *discordgo.Guild
	ChannelID string
	Channel   *discordgo.Channel
	User      *discordgo.User

	Status       VoiceStatus
	UpdateStatus VoiceStatus

	FormatText string
}

func VoiceStateParse

func VoiceStateParse(discord *discordgo.Session, v *discordgo.VoiceStateUpdate) (vd VoiceStateData)

type VoiceStatus

type VoiceStatus struct {
	ChannelJoin  bool
	ServerDeaf   bool
	ServerMute   bool
	ClientDeaf   bool
	ClientMute   bool
	ClientGoLive bool
	ClientCam    bool
}

Jump to

Keyboard shortcuts

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