#include <Discord.h>
|
| std::shared_ptr< MainGateway > | get_shard (const unsigned int shard_id) |
| |
| Guild * | get_guild (const std::string &guild_id) |
| |
| VoiceState * | get_voice_state (const std::string &user_id, const std::string &guild_id) |
| |
| void | connect () |
| |
| void | on_websocket_incoming_message (const json &payload) |
| |
| void | handle_raw_event (const std::string &event_name, const json &data) |
| |
| virtual void | on_ready (User user) |
| | called when successfully logged in
|
| |
| virtual void | on_message (Message message) |
| | called when a Message was received
|
| |
| virtual void | on_user_ban (User user, Guild guild) |
| | called when a Member was banned
|
| |
| virtual void | on_user_unban (User user, Guild guild) |
| | called when a Member was unbanned
|
| |
| virtual void | on_user_join (Member member, Guild guild) |
| | called when a User joins a Guild
|
| |
| virtual void | on_user_remove (User user, Guild guild) |
| | called when a User is removed from a Guild (leave/kick/ban)
|
| |
| virtual void | on_typing_start (User user, TextChannel channel, unsigned int timestamp) |
| | called when a User starts typing
|
| |
| virtual void | on_interaction (Interaction interaction) |
| | called when an interaction was created
|
| |
| std::string | get_token () const |
| |
| json | api_call (const std::string &url, const std::string &method="GET", const json &data=json(), const std::string &content_type="", const bool cache=true) |
| | helper function to communicate with the http api
|
| |
◆ Discord() [1/2]
| DiscordCPP::Discord::Discord |
( |
const std::string & | token, |
|
|
const Intents & | intents, |
|
|
const unsigned int | num_shards = 0 ) |
Creates a Discord instance with one or more shards
- Parameters
-
| [in] | token | Bot token for authentication |
| [in] | intents | Intents used for the gateway. |
| [in] | num_shards | (optional) number of shards that exist (default: 0 used for automatic sharding) |
◆ Discord() [2/2]
| DiscordCPP::Discord::Discord |
( |
const std::string & | token, |
|
|
const Intents & | intents, |
|
|
const unsigned int | shard_id, |
|
|
const unsigned int | num_shards ) |
Creates a Discord instance with ONE shard
- Parameters
-
| [in] | token | Bot token for authentication |
| [in] | intents | Intents used for the gateway. |
| [in] | shard_id | (optional) the id of the shard (default: 0) |
| [in] | num_shards | (optional) number of shards that exist (default: 1) |
◆ ~Discord()
| DiscordCPP::Discord::~Discord |
( |
| ) |
|
|
virtual |
◆ connect()
◆ create_application_command()
creates a new application command
◆ get_application_commands() [1/2]
loads all application commands
- Returns
- a vector containing all global application commands
◆ get_application_commands() [2/2]
loads all application commands for a guild
- Parameters
-
| [in] | guild | the Guild to get the application commands for |
- Returns
- a vector containing all application commands of the specified guild
◆ get_guild()
◆ get_shard()
◆ get_voice_state()
| DiscordCPP::VoiceState * DiscordCPP::Discord::get_voice_state |
( |
const std::string & | user_id, |
|
|
const std::string & | guild_id ) |
|
protected |
◆ handle_raw_event()
| void DiscordCPP::Discord::handle_raw_event |
( |
const std::string & | event_name, |
|
|
const json & | data ) |
|
protected |
◆ on_interaction()
| void DiscordCPP::Discord::on_interaction |
( |
Interaction | interaction | ) |
|
|
protectedvirtual |
called when an interaction was created
- Parameters
-
◆ on_message()
| void DiscordCPP::Discord::on_message |
( |
Message | message | ) |
|
|
protectedvirtual |
called when a Message was received
- Parameters
-
| [in] | message | the Message that was received |
◆ on_ready()
| void DiscordCPP::Discord::on_ready |
( |
User | user | ) |
|
|
protectedvirtual |
called when successfully logged in
- Parameters
-
◆ on_typing_start()
| void DiscordCPP::Discord::on_typing_start |
( |
User | user, |
|
|
TextChannel | channel, |
|
|
unsigned int | timestamp ) |
|
protectedvirtual |
called when a User starts typing
- Parameters
-
| [in] | user | the User that started typing |
| [in] | channel | the TextChannel where the USer started typing |
| [in] | timestamp | (unix time) when the User started typing |
◆ on_user_ban()
| void DiscordCPP::Discord::on_user_ban |
( |
User | user, |
|
|
Guild | guild ) |
|
protectedvirtual |
called when a Member was banned
- Parameters
-
| [in] | user | the User who has been banned |
| [in] | guild | the Guild the User has been banned from |
◆ on_user_join()
| void DiscordCPP::Discord::on_user_join |
( |
Member | member, |
|
|
Guild | guild ) |
|
protectedvirtual |
called when a User joins a Guild
- Parameters
-
| [in] | member | the User who has joined |
| [in] | guild | the Guild the User has joined |
◆ on_user_remove()
| void DiscordCPP::Discord::on_user_remove |
( |
User | user, |
|
|
Guild | guild ) |
|
protectedvirtual |
called when a User is removed from a Guild (leave/kick/ban)
- Parameters
-
| [in] | user | the User who has been removed |
| [in] | guild | the Guild the User has been removed from |
◆ on_user_unban()
| void DiscordCPP::Discord::on_user_unban |
( |
User | user, |
|
|
Guild | guild ) |
|
protectedvirtual |
called when a Member was unbanned
- Parameters
-
| [in] | user | the User who has been unbanned |
| [in] | guild | the Guild the User has been unbanned from |
◆ on_websocket_incoming_message()
| void DiscordCPP::Discord::on_websocket_incoming_message |
( |
const json & | payload | ) |
|
|
protected |
◆ start()
| void DiscordCPP::Discord::start |
( |
| ) |
|
Starts the bot. This will not block.
◆ update_presence()
| void DiscordCPP::Discord::update_presence |
( |
const std::string & | status, |
|
|
Activity | activity = Activity(), |
|
|
const bool | afk = false, |
|
|
const int | shard_id = -1 ) |
updates the presence of user
- Parameters
-
| [in] | status | the new status (see DiscordStatus) |
| [in] | activity | (optional) the Activity |
| [in] | afk | (optional) wether the bot/user is afk or not |
| [in] | shard_id | (optional) the shard whose presence will be updated (use -1 for all shards, default is -1) |
◆ VoiceChannel::connect
◆ _application_id
| std::string DiscordCPP::Discord::_application_id |
|
protected |
◆ _gateways
| std::vector<std::shared_ptr<MainGateway> > DiscordCPP::Discord::_gateways |
|
protected |
◆ _guilds
| std::vector<Guild*> DiscordCPP::Discord::_guilds |
|
protected |
the guilds the user is a member
◆ _num_shards
| unsigned int DiscordCPP::Discord::_num_shards |
|
protected |
◆ _user
| User* DiscordCPP::Discord::_user |
|
protected |
◆ _voice_states
| std::map<std::string, std::vector<VoiceState*> > DiscordCPP::Discord::_voice_states |
|
protected |
◆ log
| Logger DiscordCPP::Discord::log |
The documentation for this class was generated from the following files: