From 7a1270a3782f04548c8c9527006cd1ae6a04b51b Mon Sep 17 00:00:00 2001
From: HassanAbouelela Other: Useful utilities and tools for Discord bot development. Bases: A sub-class that implements many common features that Python Discord bots use. Initialise the base bot instance. guild_id ( guild_id ( allowed_roles ( http_session (aiohttp.ClientSession) – The session to use for the bot. redis_session (
Bot
-
int) – The ID of the guild use for wait_until_guild_available().int) – The ID of the guild used for wait_until_guild_available().list) – A list of role IDs that the bot is allowed to mention.Optional[RedisSession]) – The async_rediscache.RedisSession to use for the bot.
Add the given cog to the bot and log the operation.
Add command as normal and then add its root aliases to the bot.
Not implemented! Re-instantiate the bot instead of attempting to re-use a closed one.
Close the Discord connection, and the aiohttp session, connector, statsd client, and resolver.
Load all the extensions within the given module and save them to self.all_extensions.
This should be ran in a task on the event loop to avoid deadlocks caused by wait_for calls.
Log the given message to #dev-log.
Set the internal guild available event when self.guild_id becomes available.
If the cache appears to still be empty (no members, no channels, or no roles), the event will not be set and guild_available_but_cache_empty event will be emitted.
@@ -413,7 +414,7 @@ will not be set and guild_available_but_cache_empty event will be eClear the internal guild available event when self.guild_id becomes unavailable.
Ping all required services on setup to ensure they are up before starting.
Remove a command/alias as normal and then remove its root aliases from the bot.
Individual root aliases cannot be removed by this function. To remove them, either remove the entire command or manually edit bot.all_commands.
@@ -448,7 +449,7 @@ To remove them, either remove the entire command or manually edit bot.all_An async init to startup generic services.
Connects to statsd, and calls
AsyncStatsClient.create_socket
@@ -462,7 +463,7 @@ and
Wait until the guild that matches the guild_id given at init is available (and the cache is ready).
The on_ready event is inadequate because it only waits 2 seconds for a GUILD_CREATE gateway event before giving up and thus not populating the cache for unavailable guilds.
@@ -477,12 +478,12 @@ gateway event before giving up and thus not populating the cache for unavailableBases: Exception
Exception class for startup errors.