-
Notifications
You must be signed in to change notification settings - Fork 3
API Documentation
| Members | Descriptions |
|---|---|
namespace DiscordBot
|
|
struct DiscordBot::CFactory::gen
|
|
struct DiscordBot::CFactory::gen< 0, S... >
|
|
struct DiscordBot::CFactory::seq
|
| Members | Descriptions |
|---|---|
enum Intent
|
|
enum ChannelTypes
|
|
enum UserFlags
|
|
enum PremiumTypes
|
|
public inline Intent operator|(Intent lhs,Intent 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::CSongInfo
|
|
class DiscordBot::CUser
|
|
class DiscordBot::CVoiceState
|
|
class DiscordBot::IAudioSource
|
Interface for voice connections. |
class DiscordBot::ICommand
|
Interface to handle commands. |
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. |
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 |
enum ChannelTypes
| Values | Descriptions |
|---|---|
| GUILD_TEXT | |
| DM | |
| GUILD_VOICE | |
| GROUP_DM | |
| GUILD_CATEGORY | |
| GUILD_NEWS | |
| GUILD_STORE |
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 |
enum PremiumTypes
| Values | Descriptions |
|---|---|
| NONE | |
| NITRO_CLASSIC | |
| NITRO |
public inline Intent operator|(Intent lhs,Intent rhs)
| 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()
|
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()
Contains all informations about a command which was sended.
| 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
|
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 | Descriptions |
|---|---|
public std::string Title
|
|
public std::string Description
|
|
public std::string Type
|
|
public std::string URL
|
|
public inline CEmbed()
|
|
public inline ~CEmbed()
|
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
: public DiscordBot::IFactory< Base >
| Members | Descriptions |
|---|---|
public inline CFactory(Tuple Params)
|
|
public inline virtual std::shared_ptr< Base > Create()
|
|
public inline ~CFactory()
|
public inline CFactory(Tuple Params)
public inline virtual std::shared_ptr< Base > Create()
public inline ~CFactory()
| Members | Descriptions |
|---|---|
public std::string ID
|
|
public std::string Name
|
|
public std::map< std::string, GuildMember > Members
|
|
public std::map< std::string, Channel > Channels
|
|
public inline CGuild()
|
|
public inline ~CGuild()
|
public std::string ID
public std::string Name
public std::map< std::string, GuildMember > Members
public std::map< std::string, Channel > Channels
public inline CGuild()
public inline ~CGuild()
| Members | Descriptions |
|---|---|
public User UserRef
|
|
public std::string Nick
|
|
public std::vector< std::string > Roles
|
|
public std::string JoinedAt
|
|
public std::string PremiumSince
|
|
public bool Deaf
|
|
public bool Mute
|
|
public VoiceState State
|
|
public inline CGuildMember()
|
|
public inline ~CGuildMember()
|
public User UserRef
public std::string Nick
public std::vector< std::string > 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 | 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()
|
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 | Descriptions |
|---|---|
public std::string ID
|
|
public std::string Type
|
|
public int Allow
|
|
public int Deny
|
|
public inline CPermissionOverwrites()
|
|
public inline ~CPermissionOverwrites()
|
public std::string ID
public std::string Type
public int Allow
public int Deny
public inline CPermissionOverwrites()
public inline ~CPermissionOverwrites()
| Members | Descriptions |
|---|---|
public std::string Name
|
|
public std::string Path
|
|
public std::string Duration
|
|
public inline CSongInfo()
|
|
public inline virtual ~CSongInfo()
|
public std::string Name
public std::string Path
public std::string Duration
public inline CSongInfo()
public inline virtual ~CSongInfo()
| 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()
|
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 | 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()
|
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()
Interface for voice connections.
| 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()
|
public inline IAudioSource()
public uint32_t OnRead(uint16_t * Buf,uint32_t Samples)
Called if more audio data is needed.
-
BufBuffer to fill. -
SamplesSamples 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.
Must return the filled samples. If the return value is smaller than the Samples parameter, the playback is stopped after sending.
public inline ~IAudioSource()
Interface to handle commands.
| 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
|
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.
-
cmdCommand name. -
callMethod to call.
typedef OnExecuteCommand
Controller interface which receives events from the client.
All callbacks can called from different threads.
| Members | Descriptions |
|---|---|
public IController() = default
|
|
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 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 virtual ~IController() = default
|
|
protected IDiscordClient*Client
|
|
protected std::string Prefix
|
Command prefix. |
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. |
public IController() = default
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.
-
guildGuild wich contains the member -
MemberMember which voice states has been updated.
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".
-
msgMessage object. See
See also: ::CMessage for more informations.
public inline virtual void OnEndSpeaking(Guild guild)
Called if a audio source finished playing.
-
guildGuild 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 virtual ~IController() = default
protected IDiscordClient*Client
protected std::string Prefix
Command prefix.
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.
-
msgMessage object. See
See also: ::CMessage for more informations.
-
HandledSet to true if no command which is associated with the message should called.
| 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. See. |
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. Call. |
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. |
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
|
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.
See also: IController for more informations.
-
...ArgsArguments 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.
-
...ArgsArguments which are passed to the constructer of the music queue.
public inline Controller GetCurrentController()
Gets the controller which is associated with the client.
public void AddToQueue(Guild guild,SongInfo Info)
Adds a song to the music queue.
-
guildThe guild which is associated with the queue. -
InfoSong informations.
public bool StartSpeaking(Channel channel)
Connects to the given channel and uses the queue to speak.
-
channelThe voice channel to connect to.
Returns true if the connection succeeded.
public bool StartSpeaking(Channel channel,AudioSource source)
Connects to the given channel and uses the source to speak.
-
channelThe voice channel to connect to. -
sourceThe audio source for speaking.
Returns true if the connection succeeded.
public void PauseSpeaking(Guild guild)
Pauses the audio source. Call.
See also: ResumeSpeaking to continue streaming.
-
guildThe guild to pause.
public void ResumeSpeaking(Guild guild)
Resumes the audio source.
-
guildThe guild to resume.
public void StopSpeaking(Guild guild)
Stops the audio source.
-
guildThe 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.
-
channelThe voice channel to join.
public void Leave(Guild guild)
Leaves the audio channel.
-
guildThe 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.
-
channelText channel which will receive the message. -
TextText to send; -
TTSTrue to enable tts.
public AudioSource GetAudioSource(Guild guild)
Returns the audio source for the given guild. Null if there is no audio source available.
public MusicQueue GetMusicQueue(Guild guild)
Returns the music queue for the given guild. Null if there is no music queue available.
public bool IsPlaying(Guild guild)
Returns true if a audio source is playing in the given guild.
public void Run()
Runs the bot. The call returns if you calls.
See also: Quit().
public void Quit()
Quits the bot. And disconnects all voice states.
public User GetBotUser()
Gets the bot user.
public inline virtual ~IDiscordClient()
protected Controller m_Controller
protected Factory m_QueueFactory
| Members | Descriptions |
|---|---|
public inline IFactory()
|
|
public std::shared_ptr< Base > Create()
|
|
public inline ~IFactory()
|
public inline IFactory()
public std::shared_ptr< Base > Create()
public inline ~IFactory()
Thread safe music queue interface.
| 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. |
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.
-
InfoThe new song to insert.
public virtual void RemoveSong(size_t Index)
Removes a song at a given index. Calls OnRemove after removing the song.
-
IndexThe song index to remove.
public virtual void RemoveSong(std::string Name)
Removes a song with a given name. Calls OnRemove after removing the song.
-
NameName 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 a audio source for the next song. If a song is not ready call Wait and return null.
public bool HasNext()
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)
Gets the song at a given index. Returns null if the index is out of bounds.
protected size_t GetQueueIndex()
Gets the current queue index.
protected size_t GetQueueSize()
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.
-
InfoSong which was added. -
IndexIndex inside the queue.
protected inline virtual void OnRemove(SongInfo Info,size_t Index)
Called after removing a song from the queue.
-
InfoSong which was removed. -
IndexOld index inside the queue.
protected inline virtual void OnFinishPlaying(SongInfo Info)
Called if the song is finished playing.
-
InfoSong which finished playing.
protected AudioSource OnNext(SongInfo Info)
Called by Next, if a audiosource if needed.
-
InfoSong to play.
Returns a new audio source to play or null if the song isn't ready.
Describes the command.
| 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 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.
| Members | Descriptions |
|---|
| Members | Descriptions |
|---|---|
typedef Seq
|
typedef Seq
| Members | Descriptions |
|---|
Generated by Moxygen