discord

package
v0.0.0-...-8475036 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "v1.0.0-alpha"

Version of BoomBot

Variables

This section is empty.

Functions

func BotRun

func BotRun(client *disgord.Client, prefix string, gID string, yk string)

BotRun | Start the bot and react to events

func RespondToCommand

func RespondToCommand(s disgord.Session, data *disgord.MessageCreate)

RespondToCommand delegates actions when commands are issued

func RespondToMessage

func RespondToMessage(s disgord.Session, data *disgord.MessageCreate)

RespondToMessage delegates actions when messages are created

func RespondToReaction

func RespondToReaction(s disgord.Session, data *disgord.MessageReactionAdd)

RespondToReaction delegates actions when reactions are added to messages

func RespondToVoiceChannelUpdate

func RespondToVoiceChannelUpdate(s disgord.Session, data *disgord.VoiceStateUpdate)

RespondToVoiceChannelUpdate updates the server's voice channel cache every time an update is emitted

Types

type AdminReaction

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

AdminReaction defines the structure of needed reaction data

type CmdArguments

type CmdArguments []string

CmdArguments represents the arguments entered by the user after a command

type CommandEventClient

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

CommandEventClient contains the data for all command processing

func NewCommandEventClient

NewCommandEventClient returns a pointer to a new CommandEventClient

func (*CommandEventClient) Delegate

func (cec *CommandEventClient) Delegate()

Delegate evaluates commands and sends them to be processed

func (*CommandEventClient) DisectCommand

func (cec *CommandEventClient) DisectCommand() (string, []string)

DisectCommand returns the used command and all extraneous arguments

func (*CommandEventClient) ParseYoutubeArg

func (cec *CommandEventClient) ParseYoutubeArg(args []string) ([]string, bool, error)

ParseYoutubeArg handles argument parsing for the play command

type HelpCommandClient

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

HelpCommandClient contains the resources needed for handling help requests

func NewHelpCommandClient

func NewHelpCommandClient(data *disgord.Message, disgordClient disgordiface.DisgordClientAPI) *HelpCommandClient

NewHelpCommandClient returns a new instance of the HelpCommandClient

func (*HelpCommandClient) SendHelpMsg

func (hcc *HelpCommandClient) SendHelpMsg() error

SendHelpMsg sends the default help message to the channel that received the help command

type MessageEventClient

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

MessageEventClient contains the data necessary for handling all non-command messages

func NewMessageEventClient

func NewMessageEventClient(data *disgord.Message, disgordClient disgordiface.DisgordClientAPI) *MessageEventClient

NewMessageEventClient return a new MessageEventClient

func (mec *MessageEventClient) FilterNonModLinks() error

FilterNonModLinks removes all messages from mod requests channel that are not acceptable links

func (*MessageEventClient) SendEmbedMsgReply

func (mec *MessageEventClient) SendEmbedMsgReply(embed disgord.Embed) (*disgord.Message, error)

SendEmbedMsgReply sends an embeded message

type PlayingDetails

type PlayingDetails struct {
	Snippet        *youtube.VideoSnippet
	ContentDetails *youtube.VideoContentDetails
	Statistics     *youtube.VideoStatistics
}

PlayingDetails contains video data for fetched youtube songs/videos

type Queue

type Queue struct {
	UserQueue               map[disgord.Snowflake][]string
	VoiceCache              map[disgord.Snowflake]disgord.Snowflake
	GuildID                 disgord.Snowflake
	LastMessageUID          disgord.Snowflake
	LastMessageCHID         disgord.Snowflake
	NowPlayingUID           disgord.Snowflake
	LastPlayingUID          disgord.Snowflake
	NowPlayingURL           string
	Next                    chan bool
	Stop                    chan bool
	Shuffle                 chan bool
	Pause                   chan bool
	Play                    chan bool
	ChannelHop              chan disgord.Snowflake
	CurrentlyPlayingDetails PlayingDetails
}

Queue defines the data neccessary for the bot to track users/songs and where to play them

func NewQueue

func NewQueue(gID disgord.Snowflake) *Queue

NewQueue returns a new Queue instance

func (*Queue) EmptyQueue

func (q *Queue) EmptyQueue()

EmptyQueue deletes user's queue map

func (*Queue) GetEncodeSession

func (q *Queue) GetEncodeSession(url string) (*dca.EncodeSession, error)

GetEncodeSession returns a dca encoded session

func (*Queue) ListenAndProcessQueue

func (q *Queue) ListenAndProcessQueue(disgordClientAPI disgordiface.DisgordClientAPI, guild disgord.GuildQueryBuilder, ytvlc *youtube.VideosListCall)

ListenAndProcessQueue takes a message content string to fetch\encode\play audio in the voice channel the author currently resides in

func (*Queue) ManageJukebox

func (q *Queue) ManageJukebox(disgordClient disgordiface.DisgordClientAPI)

ManageJukebox scans the userqueue and updates the embed in the jukebox designated channel

func (*Queue) RemoveQueueByID

func (q *Queue) RemoveQueueByID(id disgord.Snowflake)

RemoveQueueByID removes a user's queue via their userID

func (*Queue) RemoveQueueEntry

func (q *Queue) RemoveQueueEntry()

RemoveQueueEntry removes the last queue entry and deletes the map if string slice is empty This is insane looking/literally makes my eyes glaze over looking at it Should devise a more user(reader)-friendly solution

func (*Queue) ReturnNowPlayingID

func (q *Queue) ReturnNowPlayingID() disgord.Snowflake

ReturnNowPlayingID returns the nowplayingid from the queue

func (*Queue) ReturnUserQueue

func (q *Queue) ReturnUserQueue() map[disgord.Snowflake][]string

ReturnUserQueue returns the current userqueue from the global queue cache

func (*Queue) ReturnVoiceCacheEntry

func (q *Queue) ReturnVoiceCacheEntry(id disgord.Snowflake) disgord.Snowflake

ReturnVoiceCacheEntry returns a voice queue voicecache channel id via a user's id

func (*Queue) ShuffleNowPlayingQueue

func (q *Queue) ShuffleNowPlayingQueue()

ShuffleNowPlayingQueue reorganizes the order of the queue entries for randomized playback

func (*Queue) ShuffleQueueByID

func (q *Queue) ShuffleQueueByID(id disgord.Snowflake)

func (*Queue) TriggerChannelHop

func (q *Queue) TriggerChannelHop(id disgord.Snowflake)

TriggerChannelHop sends a channelID to the queue channelhop channel For cases when the bot needs to follow a user who's song is currently playing

func (*Queue) TriggerNext

func (q *Queue) TriggerNext()

TriggerNext sends a true boolean value to the queue next channel, skipping whatever queue entry is currently playing

func (*Queue) TriggerShuffle

func (q *Queue) TriggerShuffle()

TriggerShuffle sends a true boolean value to the queue shuffle channel, shuffling whatever user queue is currently active

func (*Queue) TriggerStop

func (q *Queue) TriggerStop()

TriggerStop sends a true boolean value to the queue stop channel, stopping whatever is currently playing

func (*Queue) UpdateUserQueueState

func (q *Queue) UpdateUserQueueState(chID disgord.Snowflake, uID disgord.Snowflake, arg string)

UpdateUserQueueState updates the UserQueue cache on single song play requests

func (*Queue) UpdateUserQueueStateBulk

func (q *Queue) UpdateUserQueueStateBulk(chID disgord.Snowflake, uID disgord.Snowflake, args []string)

UpdateUserQueueStateBulk updates the UserQueue and GlobalQueue cache for playlist requests AKA 'Playloads' lolol

func (*Queue) UpdateVoiceCache

func (q *Queue) UpdateVoiceCache(chID disgord.Snowflake, uID disgord.Snowflake)

UpdateVoiceCache updates the voicechannel cache based upon the set channel id on voice state updates A channelID of 0 means a user left, in that case remove them from the cache If the user has a queue list when removed(leaves voice chat entirely) remove their queue entries from the global queue as well

type ReactionEventClient

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

ReactionEventClient defines contextual data regarding a message react event

func NewReactionEventClient

func NewReactionEventClient(emoji *disgord.Emoji, uID disgord.Snowflake, chID disgord.Snowflake, msgID disgord.Snowflake, disgordClient disgordiface.DisgordClientAPI) *ReactionEventClient

NewReactionEventClient returns a pointer to a new ReactionEventClient

func (*ReactionEventClient) GenerateModResponse

func (rec *ReactionEventClient) GenerateModResponse() (*disgord.Message, error)

GenerateModResponse returns the applicable message response if reaction criteria are met

func (*ReactionEventClient) HandleJukeboxReact

func (rec *ReactionEventClient) HandleJukeboxReact(s disgord.Session, queue *Queue, data *disgord.MessageReactionAdd)

HandleJukeboxReact triggers the playback channels of the queue in response to user reaction

type RoleManagementClient

type RoleManagementClient struct {
}

type UnknownCommandClient

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

UnknownCommandClient represents the data necessary for unknown command processing

func NewUnknownCommandClient

func NewUnknownCommandClient(data *disgord.Message, disgordClient disgordiface.DisgordClientAPI) *UnknownCommandClient

NewUnknownCommandClient returns a new instance

func (*UnknownCommandClient) RespondToChannel

func (uc *UnknownCommandClient) RespondToChannel() error

RespondToChannel handles sending a message to the channel that received an unknown command

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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