|
using | websocket = websocketpp::client< websocketpp::config::asio_tls_client > |
| Type of a pointer to the Websocket++ client.
|
|
using | connection_ptr = websocketpp::client< websocketpp::config::asio_tls_client >::connection_type::ptr |
| Type of a pointer to the Websocket++ TLS connection.
|
|
using | message_ptr = websocketpp::config::asio_client::message_type::ptr |
| Type of a pointer to the Websocket++ message payload.
|
|
using | t_on_message = std::function< void(websocketpp::connection_hdl hdl, std::string msg, shard *_shard)> |
| Websocket on_message handler type.
|
|
using | t_on_connect = std::function< void(websocketpp::connection_hdl hdl, shard *_shard)> |
| Websocket on_connect handler type.
|
|
using | t_on_close = std::function< void(websocketpp::connection_hdl hdl, shard *_shard)> |
| Websocket on_close handler type.
|
|
|
| shard_mgr (std::string token, asio::io_context &_io, std::shared_ptr< spdlog::logger > log) |
| Constructs the aegis object that tracks all of the shards, guilds, channels, and members. More...
|
|
| ~shard_mgr () |
| Destroys the shards, stops the asio::work object, destroys the websocket object, and attempts to join the rest_thread thread.
|
|
| shard_mgr (const shard_mgr &)=delete |
|
| shard_mgr (shard_mgr &&)=delete |
|
shard_mgr & | operator= (const shard_mgr &)=delete |
|
void | setup_callbacks (shard *_shard) noexcept |
| Assign the message, connect, and close callbacks to the websocket object. More...
|
|
void | debug_trace (shard *_shard, bool extended=false) noexcept |
| Outputs the last 5 messages received from the gateway. More...
|
|
asio::io_context & | get_io_context () |
| Get the internal (or external) io_service object. More...
|
|
void | shutdown () |
|
websocket & | get_websocket () noexcept |
| Get the internal Websocket++ instance. More...
|
|
bot_status | get_state () const noexcept |
| Get the current state of the shard manager. More...
|
|
void | set_state (bot_status s) noexcept |
| Set the current shard manager state. More...
|
|
std::string | uptime () const noexcept |
| Return bot uptime as {days hours minutes seconds}. More...
|
|
void | send_all_shards (const std::string &msg) |
| Send a websocket message to a single shard. More...
|
|
void | send_all_shards (const json &msg) |
| Send a websocket message to a single shard. More...
|
|
void | start () |
| Start shard connections and shard status timer.
|
|
void | set_on_message (t_on_message cb) noexcept |
| Set handler for websocket messages. More...
|
|
void | set_on_connect (t_on_connect cb) noexcept |
| Set handler for websocket connections. More...
|
|
void | set_on_close (t_on_close cb) noexcept |
| Set handler for websocket disconnections. More...
|
|
void | set_gateway_url (const std::string &url) noexcept |
| Set the gateway url the shards will connect to. More...
|
|
std::string | get_gateway_url () const noexcept |
| Get the gateway url the shards will connect to. More...
|
|
void | reset_shard (shard *_shard, shard_status _status=shard_status::closing) noexcept |
| Resets the shard's state. More...
|
|
void | queue_reconnect (shard *_shard) noexcept |
| Queue the shard for reconnection. Typically only called internally. More...
|
|
void | queue_reconnect (shard &_shard) |
| Queue the shard for reconnection. Typically only called internally. More...
|
|
void | connect (shard *_shard) noexcept |
| Connect the shard to the gateway. Typically only called internally. More...
|
|
shard & | get_shard (uint16_t shard_id) |
| Get the shard object. More...
|
|
const std::vector
< std::unique_ptr< shard > > & | get_shards () const noexcept |
| Get a const vector of all the shards. More...
|
|
void | close (shard *_shard, int32_t code=1001, const std::string &reason="", shard_status connection_state=shard_status::closing) noexcept |
| Close the shard's websocket connection. More...
|
|
void | close (shard &_shard, int32_t code=1001, const std::string &reason="", shard_status connection_state=shard_status::closing) noexcept |
| Close the shard's websocket connection. More...
|
|
uint32_t | shard_count () const noexcept |
| Get the amount of shards that exist. More...
|
|
Primary class for managing a bot interface.
Only one instance of this object can exist safely