Skip to content

API Documentation

tostc edited this page May 31, 2020 · 5 revisions

Summary

Members Descriptions
namespace DiscordBot
struct DiscordBot::CFactory::gen
struct DiscordBot::CFactory::gen< 0, S... >
struct DiscordBot::CFactory::seq

namespace DiscordBot

Summary

Members Descriptions
enum AccessMode Access modes for commands.
enum Intent
enum ChannelTypes
enum Permission Permission bits for different roles. For more info see here.
enum UserFlags
enum PremiumTypes
public DISCORDBOT_EXPORT std::string AccessModeToString(AccessMode Mode)
public inline Intent operator|(Intent lhs,Intent rhs)
public inline Permission operator|(Permission lhs,Permission rhs)
public inline Permission operator&(Permission lhs,Permission rhs)
class DiscordBot::CChannel
class DiscordBot::CCommandContext Contains all informations about a command which was sended.
class DiscordBot::CEmbed
class DiscordBot::CFactory
class DiscordBot::CGuild
class DiscordBot::CGuildMember
class DiscordBot::CMessage
class DiscordBot::CPermissionOverwrites
class DiscordBot::CRole
class DiscordBot::CSongInfo
class DiscordBot::CUser
class DiscordBot::CVoiceState
class DiscordBot::IAudioSource Interface for voice connections.
class DiscordBot::ICommand Interface to handle commands.
class DiscordBot::ICommandsConfig
class DiscordBot::IController Controller interface which receives events from the client.
class DiscordBot::IDiscordClient
class DiscordBot::IFactory
class DiscordBot::IMusicQueue Thread safe music queue interface.
struct DiscordBot::SCommandDescription Describes the command.

Members

enum AccessMode

Values Descriptions
OWNER This command can only be accessed by the owner.
ROLE This command can only be accessed by a given role.
EVERYBODY Free for all.

Access modes for commands.

enum Intent

Values Descriptions
GUILDS
GUILD_MEMBERS
GUILD_BANS
GUILD_EMOJIS
GUILD_INTEGRATIONS
GUILD_WEBHOOKS
GUILD_INVITES
GUILD_VOICE_STATES
GUILD_PRESENCES
GUILD_MESSAGES
GUILD_MESSAGE_REACTIONS
GUILD_MESSAGE_TYPING
DIRECT_MESSAGES
DIRECT_MESSAGE_REACTIONS
DIRECT_MESSAGE_TYPING
DEFAULTS
Values Descriptions
GUILD_TEXT
DM
GUILD_VOICE
GROUP_DM
GUILD_CATEGORY
GUILD_NEWS
GUILD_STORE

enum Permission

Values Descriptions
CREATE_INSTANT_INVITE Allows creation of instant invites, T, V.
KICK_MEMBERS Allows kicking members.
BAN_MEMBERS Allows banning members.
ADMINISTRATOR Allows all permissions and bypasses channel permission overwrites.
MANAGE_CHANNELS Allows management and editing of channels T, V.
MANAGE_GUILD Allows management and editing of the guild.
ADD_REACTIONS Allows for the addition of reactions to messages T.
VIEW_AUDIT_LOG Allows for viewing of audit logs.
PRIORITY_SPEAKER Allows for using priority speaker in a voice channel V.
STREAM Allows the user to go live V.
VIEW_CHANNEL Allows guild members to view a channel, which includes reading messages in text channels T, V.
SEND_MESSAGES Allows for sending messages in a channel T.
SEND_TTS_MESSAGES Allows for sending of /tts messages T.
MANAGE_MESSAGES Allows for deletion of other users messages T.
EMBED_LINKS Links sent by users with this permission will be auto-embedded T.
ATTACH_FILES Allows for uploading images and files T.
READ_MESSAGE_HISTORY Allows for reading of message history T.
MENTION_EVERYONE Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel T.
USE_EXTERNAL_EMOJIS Allows the usage of custom emojis from other servers T.
VIEW_GUILD_INSIGHTS Allows for viewing guild insights.
CONNECT Allows for joining of a voice channel V.
SPEAK Allows for speaking in a voice channel V.
MUTE_MEMBERS Allows for muting members in a voice channel V.
DEAFEN_MEMBERS Allows for deafening of members in a voice channel V.
MOVE_MEMBERS Allows for moving of members between voice channels V.
USE_VAD Allows for using voice-activity-detection in a voice channel V.
CHANGE_NICKNAME Allows for modification of own nickname.
MANAGE_NICKNAMES Allows for modification of other users nicknames.
MANAGE_ROLES Allows management and editing of roles T, V.
MANAGE_WEBHOOKS Allows management and editing of webhooks T, V.
MANAGE_EMOJIS Allows management and editing of emojis.

Permission bits for different roles. For more info see here.

enum UserFlags

Values Descriptions
NONE
DISCORD_EMPLOYEE
DISCORD_PARTNER
HYPESQUAD_EVENTS
BUG_HUNTER_LEVEL_1
HOUSE_BRAVERY
HOUSE_BRILLIANCE
HOUSE_BALANCE
EARLY_SUPPORTER
TEAM_USER
SYSTEM
BUG_HUNTER_LEVEL_2
VERIFIED_BOT
VERIFIED_BOT_DEVELOPER
Values Descriptions
NONE
NITRO_CLASSIC
NITRO

public DISCORDBOT_EXPORT std::string AccessModeToString(AccessMode Mode)

public inline Intent operator|(Intent lhs,Intent rhs)

public inline Permission operator|(Permission lhs,Permission rhs)

public inline Permission operator&(Permission lhs,Permission rhs)

class DiscordBot::CChannel

Summary

Members Descriptions
public std::string ID
public ChannelTypes Type
public std::string GuildID
public int Position
public std::vector< PermissionOverwrites > Overwrites
public std::string Name
public std::string Topic
public bool NSFW
public std::string LastMessageID
public int Bitrate
public int UserLimit
public int RateLimit
public std::vector< User > Recipients
public std::string Icon
public std::string OwnerID
public std::string AppID
public std::string ParentID
public std::string LastPinTimestamp
public inline CChannel()
public inline ~CChannel()

Members

public std::string ID

public ChannelTypes Type

public std::string GuildID

public int Position

public std::vector< PermissionOverwrites > Overwrites

public std::string Name

public std::string Topic

public bool NSFW

public std::string LastMessageID

public int Bitrate

public int UserLimit

public int RateLimit

public std::vector< User > Recipients

public std::string Icon

public std::string OwnerID

public std::string AppID

public std::string ParentID

public std::string LastPinTimestamp

public inline CChannel()

public inline ~CChannel()

class DiscordBot::CCommandContext

Contains all informations about a command which was sended.

Summary

Members Descriptions
public Message Msg Message wich contains the command.
public std::string Command Command without prefix.
public std::vector< std::string > Params Command parameters.
public CCommandContext() = default
public ~CCommandContext() = default

Members

public Message Msg

Message wich contains the command.

public std::string Command

Command without prefix.

public std::vector< std::string > Params

Command parameters.

public CCommandContext() = default

public ~CCommandContext() = default

class DiscordBot::CEmbed

Summary

Members Descriptions
public std::string Title
public std::string Description
public std::string Type
public std::string URL
public inline CEmbed()
public inline ~CEmbed()

Members

public std::string Title

public std::string Description

public std::string Type

public std::string URL

public inline CEmbed()

public inline ~CEmbed()

class DiscordBot::CFactory

class DiscordBot::CFactory
  : public DiscordBot::IFactory< Base >

Summary

Members Descriptions
public inline CFactory(Tuple Params)
public inline virtual std::shared_ptr< Base > Create()
public inline ~CFactory()

Members

public inline CFactory(Tuple Params)

public inline virtual std::shared_ptr< Base > Create()

public inline ~CFactory()

class DiscordBot::CGuild

Summary

Members Descriptions
public std::string ID
public std::string Name
public GuildMember Owner
public std::map< std::string, GuildMember > Members
public std::map< std::string, Channel > Channels
public std::map< std::string, Role > Roles
public inline CGuild()
public inline ~CGuild()

Members

public std::string ID

public std::string Name

public GuildMember Owner

public std::map< std::string, GuildMember > Members

public std::map< std::string, Channel > Channels

public std::map< std::string, Role > Roles

public inline CGuild()

public inline ~CGuild()

class DiscordBot::CGuildMember

Summary

Members Descriptions
public User UserRef
public std::string Nick
public std::vector< Role > Roles
public std::string JoinedAt
public std::string PremiumSince
public bool Deaf
public bool Mute
public VoiceState State
public inline CGuildMember()
public inline ~CGuildMember()

Members

public User UserRef

public std::string Nick

public std::vector< Role > Roles

public std::string JoinedAt

public std::string PremiumSince

public bool Deaf

public bool Mute

public VoiceState State

public inline CGuildMember()

public inline ~CGuildMember()

class DiscordBot::CMessage

Summary

Members Descriptions
public std::string ID
public Channel ChannelRef Could contain a dummy channel if this is a dm. Only the id field is filled.
public Guild GuildRef
public User Author
public GuildMember Member
public std::string Content
public std::string Timestamp
public std::string EditedTimestamp
public bool Mention
public std::vector< GuildMember > Mentions Could contains dummy Guild Members if this is a dm. Only the UserRef field is filled.
public inline CMessage()
public inline ~CMessage()

Members

public std::string ID

public Channel ChannelRef

Could contain a dummy channel if this is a dm. Only the id field is filled.

public Guild GuildRef

public User Author

public GuildMember Member

public std::string Content

public std::string Timestamp

public std::string EditedTimestamp

public bool Mention

public std::vector< GuildMember > Mentions

Could contains dummy Guild Members if this is a dm. Only the UserRef field is filled.

public inline CMessage()

public inline ~CMessage()

class DiscordBot::CPermissionOverwrites

Summary

Members Descriptions
public std::string ID User or role id.
public std::string Type role or user
public Permission Allow
public Permission Deny
public inline CPermissionOverwrites()
public inline ~CPermissionOverwrites()

Members

public std::string ID

User or role id.

public std::string Type

role or user

public Permission Allow

public Permission Deny

public inline CPermissionOverwrites()

public inline ~CPermissionOverwrites()

class DiscordBot::CRole

Summary

Members Descriptions
public std::string ID
public std::string Name
public uint32_t Color
public bool Hoist
public int Position
public Permission Permissions
public bool Managed
public bool Mentionable
public inline CRole()
public inline ~CRole()

Members

public std::string ID

public std::string Name

public uint32_t Color

public bool Hoist

public int Position

public Permission Permissions

public bool Managed

public bool Mentionable

public inline CRole()

public inline ~CRole()

class DiscordBot::CSongInfo

Summary

Members Descriptions
public std::string Name
public std::string Path
public std::string Duration
public inline CSongInfo()
public inline virtual ~CSongInfo()

Members

public std::string Name

public std::string Path

public std::string Duration

public inline CSongInfo()

public inline virtual ~CSongInfo()

class DiscordBot::CUser

Summary

Members Descriptions
public std::string ID
public std::string Username
public std::string Discriminator
public std::string Avatar
public bool Bot
public bool System
public bool MFAEnabled
public std::string Locale
public bool Verified
public std::string Email
public UserFlags Flags
public PremiumTypes PremiumType
public UserFlags PublicFlags
public inline CUser()
public inline ~CUser()

Members

public std::string ID

public std::string Username

public std::string Discriminator

public std::string Avatar

public bool Bot

public bool System

public bool MFAEnabled

public std::string Locale

public bool Verified

public std::string Email

public UserFlags Flags

public PremiumTypes PremiumType

public UserFlags PublicFlags

public inline CUser()

public inline ~CUser()

class DiscordBot::CVoiceState

Summary

Members Descriptions
public Guild GuildRef
public Channel ChannelRef
public User UserRef
public std::string SessionID
public bool Deaf
public bool Mute
public bool SelfDeaf
public bool SelfMute
public bool SelfStream
public bool Supress
public inline CVoiceState()
public inline ~CVoiceState()

Members

public Guild GuildRef

public Channel ChannelRef

public User UserRef

public std::string SessionID

public bool Deaf

public bool Mute

public bool SelfDeaf

public bool SelfMute

public bool SelfStream

public bool Supress

public inline CVoiceState()

public inline ~CVoiceState()

class DiscordBot::IAudioSource

Interface for voice connections.

Summary

Members Descriptions
public inline IAudioSource()
public uint32_t OnRead(uint16_t * Buf,uint32_t Samples) Called if more audio data is needed.
public inline ~IAudioSource()

Members

public inline IAudioSource()

public uint32_t OnRead(uint16_t * Buf,uint32_t Samples)

Called if more audio data is needed.

Parameters

  • Buf Buffer to fill.

  • Samples Samples per channel. The complete buffer size if Samples * Channelcount. The channel count used by this library is 2.

The audio samplerate must 48000 Hz and stereo.

Returns

Must return the filled samples. If the return value is smaller than the Samples parameter, the playback is stopped after sending.

public inline ~IAudioSource()

class DiscordBot::ICommand

Interface to handle commands.

Summary

Members Descriptions
public ICommand() = default
public void OnExecute(CommandContext Context) Called by the controller if a command with is associated with this instance, is called.
public virtual ~ICommand() = default
protected void RegisterCommandHandler(const std::string & Cmd,OnExecuteCommand call) Registers a new command handler function.
typedef OnExecuteCommand

Members

public ICommand() = default

public void OnExecute(CommandContext Context)

Called by the controller if a command with is associated with this instance, is called.

public virtual ~ICommand() = default

protected void RegisterCommandHandler(const std::string & Cmd,OnExecuteCommand call)

Registers a new command handler function.

Parameters

  • cmd Command name.

  • call Method to call.

class DiscordBot::ICommandsConfig

Summary

Members Descriptions
public inline ICommandsConfig()
public void AddRoles(const std::string & Guild,const std::string & Command,const std::vector< std::string > & Roles) Adds roles to a given command for a given server.
public std::vector< std::string > GetRoles(const std::string & Guild,const std::string & Command) #### Returns
public void DeleteCommand(const std::string & Guild,const std::string & Command) Deletes the config for a given command on a given server.
public void RemoveRoles(const std::string & Guild,const std::string & Command,const std::vector< std::string > & Roles) Removes given roles of a command.
public inline virtual ~ICommandsConfig()

Members

public inline ICommandsConfig()

public void AddRoles(const std::string & Guild,const std::string & Command,const std::vector< std::string > & Roles)

Adds roles to a given command for a given server.

Parameters

  • Guild Server to save the config for.

  • Command Command name. e.g. 'h'

  • Roles List of roles to apply to the command. Only users with these roles can access the command.

public std::vector< std::string > GetRoles(const std::string & Guild,const std::string & Command)

Returns

Returns a list of a command for a given guild.

public void DeleteCommand(const std::string & Guild,const std::string & Command)

Deletes the config for a given command on a given server.

public void RemoveRoles(const std::string & Guild,const std::string & Command,const std::vector< std::string > & Roles)

Removes given roles of a command.

public inline virtual ~ICommandsConfig()

class DiscordBot::IController

Controller interface which receives events from the client.

All callbacks can called from different threads.

Summary

Members Descriptions
public IController(IDiscordClient * client)
public inline virtual void OnReady() Called if the handshake with discord is finished.
public inline virtual void OnVoiceStateUpdate(Guild guild,GuildMember Member) Called if the voice state of a guild member updates. Eg. move, connect, disconnect.
public inline virtual void OnMemberAdd(Guild guild,GuildMember Member) Called if a guild member joins.
public inline virtual void OnMemberUpdate(Guild guild,GuildMember Member) Called if a guild member updates. E.g. Nick, premium support, roles.
public inline virtual void OnMemberRemove(Guild guild,GuildMember Member) Called if a guild member leaves a guild. E.g. Ban, kick, leave.
public void OnMessage(Message msg) Called if a new message was sended. Process the message and call associated commands.
public inline virtual void OnEndSpeaking(Guild guild) Called if a audio source finished playing.
public inline virtual void OnResume() Called if the client resumes the session with discord.
public inline virtual void OnDisconnect() Called if the bot lose the connection to discord or when the bot quits.
public inline virtual void OnQuit() Called if.
public inline std::string GetPrefix() #### Returns
public inline CommandsConfig GetCmdConfig() #### Returns
public inline bool CommandExists(const std::string & Cmd)
public inline AccessMode GetAccessMode(const std::string & Cmd)
public std::vector< SCommandDescription>GetCommands(Guild guild,GuildMember member) #### Returns
public virtual ~IController() = default
protected IDiscordClient*Client
protected std::string Prefix Command prefix.
protected CommandsConfig CmdsConfig Member to save and load the config for the different commands.
protected template<>
inline void RegisterCommand(SCommandDescription Desc,Args ... args)
protected inline virtual void OnMessage(Message msg,bool & Handled) Called if a new message was sended.

Members

public IController(IDiscordClient * client)

public inline virtual void OnReady()

Called if the handshake with discord is finished.

public inline virtual void OnVoiceStateUpdate(Guild guild,GuildMember Member)

Called if the voice state of a guild member updates. Eg. move, connect, disconnect.

Parameters

  • guild Guild which contains the member

  • Member Member which voice states has been updated.

The GUILD_VOICE_STATES intent needs to be set to receive this event. This intent is set by default.

See also: Intent

public inline virtual void OnMemberAdd(Guild guild,GuildMember Member)

Called if a guild member joins.

Parameters

  • guild Guild which contains the member

  • Member Member which has been join.

The GUILD_MEMBERS intent needs to be set to receive this event. Also you must activate "Server Members Intent" under the bot section of your Discord Application (Website).This intent is set by default.

See also: Intent

public inline virtual void OnMemberUpdate(Guild guild,GuildMember Member)

Called if a guild member updates. E.g. Nick, premium support, roles.

Parameters

  • guild Guild which contains the member

  • Member Member which has been updated.

The GUILD_MEMBERS intent needs to be set to receive this event. Also you must activate "Server Members Intent" under the bot section of your Discord Application (Website).This intent is set by default.

See also: Intent

public inline virtual void OnMemberRemove(Guild guild,GuildMember Member)

Called if a guild member leaves a guild. E.g. Ban, kick, leave.

Parameters

  • guild Guild which had contains the member

  • Member Member which leaves

The GUILD_MEMBERS intent needs to be set to receive this event. Also you must activate "Server Members Intent" under the bot section of your Discord Application (Website).This intent is set by default.

See also: Intent

public void OnMessage(Message msg)

Called if a new message was sended. Process the message and call associated commands.

Integrated help command "Prefix h" or "Prefix help".

Parameters

  • msg Message object.

See also: CMessage for more informations.

The GUILD_MESSAGES intent needs to be set to receive this event. This intent is set by default.

See also: Intent

public inline virtual void OnEndSpeaking(Guild guild)

Called if a audio source finished playing.

Parameters

  • guild Guild where the audio source finished.

public inline virtual void OnResume()

Called if the client resumes the session with discord.

public inline virtual void OnDisconnect()

Called if the bot lose the connection to discord or when the bot quits.

public inline virtual void OnQuit()

Called if.

See also: IDiscordClient::Quit() is called.

In some situations the Quit() method is called internally from the client. This occurs if there is a huge error.

public inline std::string GetPrefix()

Returns

Gets the command prefix.

public inline CommandsConfig GetCmdConfig()

Returns

Gets the commands config.

public inline bool CommandExists(const std::string & Cmd)

public inline AccessMode GetAccessMode(const std::string & Cmd)

public std::vector< SCommandDescription>GetCommands(Guild guild,GuildMember member)

Returns

Gets all commands for a member. Only commands which the member can execute will be return.

public virtual ~IController() = default

protected std::string Prefix

Command prefix.

protected CommandsConfig CmdsConfig

Member to save and load the config for the different commands.

See also: ICommandsConfig for more informations

protected template<>
inline void RegisterCommand(SCommandDescription Desc,Args ... args)

protected inline virtual void OnMessage(Message msg,bool & Handled)

Called if a new message was sended.

Parameters

  • msg Message object.

See also: CMessage for more informations.

Parameters

  • Handled Set to true if no command which is associated with the message should called.

class DiscordBot::IDiscordClient

Summary

Members Descriptions
public inline IDiscordClient()
public template<>
inline void RegisterController(Args &&... args)
Registers a controller for this client. This controller receives all events of the client.
public template<>
inline void RegisterMusicQueue(Args &&... args)
Registers a music queue template for this client. This queue type will created for each connected voice server and handles the audio.
public inline Controller GetCurrentController() #### Returns
public void AddToQueue(Guild guild,SongInfo Info) Adds a song to the music queue.
public bool StartSpeaking(Channel channel) Connects to the given channel and uses the queue to speak.
public bool StartSpeaking(Channel channel,AudioSource source) Connects to the given channel and uses the source to speak.
public void PauseSpeaking(Guild guild) Pauses the audio source.
public void ResumeSpeaking(Guild guild) Resumes the audio source.
public void StopSpeaking(Guild guild) Stops the audio source.
public void RemoveSong(Channel channel,size_t Index) Removes a song from the queue by its index.
public void RemoveSong(Channel channel,const std::string & Name) Removes a song from the queue by its title or part of the title.
public void Join(Channel channel) Joins a audio channel.
public void Leave(Guild guild) Leaves the audio channel.
public void SendMessage(Channel channel,const std::string Text,Embed embed,bool TTS) Sends a message to a given channel.
public AudioSource GetAudioSource(Guild guild) #### Returns
public MusicQueue GetMusicQueue(Guild guild) #### Returns
public bool IsPlaying(Guild guild) #### Returns
public void Run() Runs the bot. The call returns if you calls Quit().
public void Quit() Quits the bot. And disconnects all voice states.
public User GetBotUser() #### Returns
public inline virtual ~IDiscordClient()
protected Controller m_Controller
protected Factory m_QueueFactory

Members

public inline IDiscordClient()

public template<>
inline void RegisterController(Args &&... args)

Registers a controller for this client. This controller receives all events of the client.

See also: IController for more informations.

Parameters

  • T Derived class of IController

  • ...Args Arguments which are passed to the constructer of the controller.

public template<>
inline void RegisterMusicQueue(Args &&... args)

Registers a music queue template for this client. This queue type will created for each connected voice server and handles the audio.

Parameters

  • T Derived class of IMusicQueue

  • ...Args Arguments which are passed to the constructer of the music queue.

public inline Controller GetCurrentController()

Returns

Gets the controller which is associated with the client.

public void AddToQueue(Guild guild,SongInfo Info)

Adds a song to the music queue.

Parameters

  • guild The guild which is associated with the queue.

  • Info Song informations.

public bool StartSpeaking(Channel channel)

Connects to the given channel and uses the queue to speak.

Parameters

  • channel The voice channel to connect to.

Returns

Returns true if the connection succeeded.

public bool StartSpeaking(Channel channel,AudioSource source)

Connects to the given channel and uses the source to speak.

Parameters

  • channel The voice channel to connect to.

  • source The audio source for speaking.

Returns

Returns true if the connection succeeded.

public void PauseSpeaking(Guild guild)

Pauses the audio source.

See also: ResumeSpeaking to continue streaming.

Parameters

  • guild The guild to pause.

public void ResumeSpeaking(Guild guild)

Resumes the audio source.

Parameters

  • guild The guild to resume.

public void StopSpeaking(Guild guild)

Stops the audio source.

Parameters

  • guild The guild to stop.

public void RemoveSong(Channel channel,size_t Index)

Removes a song from the queue by its index.

public void RemoveSong(Channel channel,const std::string & Name)

Removes a song from the queue by its title or part of the title.

public void Join(Channel channel)

Joins a audio channel.

Parameters

  • channel The voice channel to join.

public void Leave(Guild guild)

Leaves the audio channel.

Parameters

  • guild The guild to leave the voice channel.

public void SendMessage(Channel channel,const std::string Text,Embed embed,bool TTS)

Sends a message to a given channel.

Parameters

  • channel Text channel which will receive the message.

  • Text Text to send;

  • TTS True to enable tts.

public AudioSource GetAudioSource(Guild guild)

Returns

Returns the audio source for the given guild. Null if there is no audio source available.

public MusicQueue GetMusicQueue(Guild guild)

Returns

Returns the music queue for the given guild. Null if there is no music queue available.

public bool IsPlaying(Guild guild)

Returns

Returns true if a audio source is playing in the given guild.

public void Run()

Runs the bot. The call returns if you calls Quit().

See also: Quit()

public void Quit()

Quits the bot. And disconnects all voice states.

public User GetBotUser()

Returns

Gets the bot user.

public inline virtual ~IDiscordClient()

protected Controller m_Controller

protected Factory m_QueueFactory

class DiscordBot::IFactory

Summary

Members Descriptions
public inline IFactory()
public std::shared_ptr< Base > Create()
public inline ~IFactory()

Members

public inline IFactory()

public std::shared_ptr< Base > Create()

public inline ~IFactory()

class DiscordBot::IMusicQueue

Thread safe music queue interface.

Summary

Members Descriptions
public inline IMusicQueue()
public virtual void AddSong(SongInfo Info) Adds a song to the queue. Calls OnUpdate after the song is added. Called from the client.
public virtual void RemoveSong(size_t Index) Removes a song at a given index. Calls OnRemove after removing the song.
public virtual void RemoveSong(std::string Name) Removes a song with a given name. Calls OnRemove after removing the song.
public virtual void ClearQueue() Called if the queue finished playing. Calls OnRemove for each element.
public virtual AudioSource Next() #### Returns
public bool HasNext() #### Returns
public inline bool NeedWait() Returns true if a song is not ready.
public inline void SetGuildID(const std::string & ID)
public inline void SetOnWaitFinishCallback(OnWaitFinish Call) Called by the client to the on wait finish callback.
public inline virtual ~IMusicQueue()
protected SongInfo GetSong(size_t Index) #### Returns
protected size_t GetQueueIndex() #### Returns
protected size_t GetQueueSize() #### Returns
protected void WaitFinished() Should called after Wait, if the song becomes ready. Calls OnNext.
protected void WaitFailed() Should called after Wait, if the song becomes not ready. Calls indirect Next.
protected inline virtual void OnUpdate(SongInfo Info,size_t Index) Called after adding songs to the queue.
protected inline virtual void OnRemove(SongInfo Info,size_t Index) Called after removing a song from the queue.
protected inline virtual void OnFinishPlaying(SongInfo Info) Called if the song is finished playing.
protected AudioSource OnNext(SongInfo Info) Called by Next, if a audiosource if needed.

Members

public inline IMusicQueue()

public virtual void AddSong(SongInfo Info)

Adds a song to the queue. Calls OnUpdate after the song is added. Called from the client.

Parameters

  • Info The new song to insert.

public virtual void RemoveSong(size_t Index)

Removes a song at a given index. Calls OnRemove after removing the song.

Parameters

  • Index The song index to remove.

public virtual void RemoveSong(std::string Name)

Removes a song with a given name. Calls OnRemove after removing the song.

Parameters

  • Name Name or part of the name to remove.

public virtual void ClearQueue()

Called if the queue finished playing. Calls OnRemove for each element.

public virtual AudioSource Next()

Returns

Returns a audio source for the next song. If a song is not ready call Wait and return null.

public bool HasNext()

Returns

Returns true if there is a next song.

public inline bool NeedWait()

Returns true if a song is not ready.

public inline void SetGuildID(const std::string & ID)

public inline void SetOnWaitFinishCallback(OnWaitFinish Call)

Called by the client to the on wait finish callback.

public inline virtual ~IMusicQueue()

protected SongInfo GetSong(size_t Index)

Returns

Gets the song at a given index. Returns null if the index is out of bounds.

protected size_t GetQueueIndex()

Returns

Gets the current queue index.

protected size_t GetQueueSize()

Returns

Gets the current queue size.

protected void WaitFinished()

Should called after Wait, if the song becomes ready. Calls OnNext.

protected void WaitFailed()

Should called after Wait, if the song becomes not ready. Calls indirect Next.

protected inline virtual void OnUpdate(SongInfo Info,size_t Index)

Called after adding songs to the queue.

Parameters

  • Info Song which was added.

  • Index Index inside the queue.

protected inline virtual void OnRemove(SongInfo Info,size_t Index)

Called after removing a song from the queue.

Parameters

  • Info Song which was removed.

  • Index Old index inside the queue.

protected inline virtual void OnFinishPlaying(SongInfo Info)

Called if the song is finished playing.

Parameters

  • Info Song which finished playing.

protected AudioSource OnNext(SongInfo Info)

Called by Next, if a audiosource if needed.

Parameters

  • Info Song to play.

Returns

Returns a new audio source to play or null if the song isn't ready.

struct DiscordBot::SCommandDescription

Describes the command.

Summary

Members Descriptions
public std::string Cmd Command name.
public std::string Description Command description. Shows in the help dialog.
public int ParamCount Expected parameter count.
public std::string ParamDelimiter Delimiter for multiple parameters.
public AccessMode Mode Access mode for this command. This is the default mode for a new server. The owner can access all commands.

Members

public std::string Cmd

Command name.

public std::string Description

Command description. Shows in the help dialog.

public int ParamCount

Expected parameter count.

public std::string ParamDelimiter

Delimiter for multiple parameters.

public AccessMode Mode

Access mode for this command. This is the default mode for a new server. The owner can access all commands.

See also: AccessMode

struct DiscordBot::CFactory::gen

Summary

Members Descriptions

Members

struct DiscordBot::CFactory::gen< 0, S... >

Summary

Members Descriptions
typedef Seq

Members

typedef Seq

struct DiscordBot::CFactory::seq

Summary

Members Descriptions

Members

Generated by Moxygen