client

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Client is discord client.

func New

func New(token string) (*Client, error)

New to create new discord client.

func (*Client) AddMessageHandler

func (c *Client) AddMessageHandler(handler func(*discordgo.Session, *discordgo.MessageCreate))

AddMessageHandler to add message handler.

func (*Client) AddReactionHandler

func (c *Client) AddReactionHandler(handler func(*discordgo.Session, *discordgo.MessageReactionAdd))

AddReactionHandler to add reaction handler.

func (*Client) AddReadyHandler

func (c *Client) AddReadyHandler(handler func(*discordgo.Session, *discordgo.Ready))

AddReadyHandler to add ready handler.

func (*Client) Close

func (c *Client) Close() error

Close to stop discord bot.

func (*Client) EditMessage

func (c *Client) EditMessage(ctx context.Context, cID, mID, content string) (string, error)

EditMessage to edit message.

func (*Client) EditMessageEmbed

func (c *Client) EditMessageEmbed(ctx context.Context, cID, mID string, content *discordgo.MessageEmbed) (string, error)

EditMessageEmbed to edit embed message.

func (*Client) GetChannelID

func (c *Client) GetChannelID(gID string) string

GetChannelID to get channel id.

func (*Client) GetDisableAutoNext

func (c *Client) GetDisableAutoNext(gID string) bool

GetDisableAutoNext to get disable auto next.

func (*Client) GetGuildByChannelID

func (c *Client) GetGuildByChannelID(ctx context.Context, cID string) (*discordgo.Guild, error)

GetGuildByChannelID to get guild by channel id.

func (*Client) GetStopped

func (c *Client) GetStopped(gID string) bool

GetStopped to get stopped.

func (*Client) InitVoice

func (c *Client) InitVoice(gID string)

InitVoice to init discord voice.

func (*Client) IsPlayerExist

func (c *Client) IsPlayerExist(gID string) bool

IsPlayerExist to get is player exist.

func (*Client) IsPlaying

func (c *Client) IsPlaying(gID string) bool

IsPlaying to get is playing.

func (*Client) JoinVoiceChannel

func (c *Client) JoinVoiceChannel(ctx context.Context, m *discordgo.MessageCreate, g *discordgo.Guild) error

JoinVoiceChannel to join voice channel.

func (*Client) LeaveVoiceChannel

func (c *Client) LeaveVoiceChannel(ctx context.Context, m *discordgo.MessageCreate, g *discordgo.Guild) error

LeaveVoiceChannel to leave voice channel.

func (*Client) Pause

func (c *Client) Pause(gID string)

Pause to pause.

func (*Client) Resume

func (c *Client) Resume(gID string)

Resume to resume.

func (*Client) Run

func (c *Client) Run() error

Run to login and start discord bot.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, cID, content string) (string, error)

SendMessage to send message.

func (*Client) SendMessageEmbed

func (c *Client) SendMessageEmbed(ctx context.Context, cID string, content *discordgo.MessageEmbed) (string, error)

SendMessageEmbed to send embed message.

func (*Client) SetDisableAutoNext

func (c *Client) SetDisableAutoNext(gID string, value bool)

SetDisableAutoNext to set disable auto next.

func (*Client) SetPlayerExist

func (c *Client) SetPlayerExist(gID string, value bool)

SetPlayerExist to set player exist.

func (*Client) SetPlaying

func (c *Client) SetPlaying(ctx context.Context, gID string, value bool) error

SetPlaying to set playing.

func (*Client) Skip

func (c *Client) Skip(gID string)

Skip to skip.

func (*Client) Stop

func (c *Client) Stop(gID string)

Stop to stop.

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, gID, path string) (err error)

Stream to stream audio.

Jump to

Keyboard shortcuts

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