Shared cogs and utilities for use in Discord bots
Project description
Bot Bin
Shared cogs and utilities for use in Discord bots.
Some cogs require bot configuration; those that do expect a bot.config
dict attribute.
bot_bin.bot
Contains an AutoShardedBot subclass. Contains custom error logging, customizable on_message bot ignoring, case insensitive prefixes, and database setup if the setup_db kwarg is set to True. Requires the config kwarg to be set to a dict. bot.config['tokens']['discord'] should be the bot's Discord token.
bot_bin.debug
Contains memory usage and performance debugging commands. Most other debug functionality is already provided by jishaku.
bot_bin.misc
Contains an uptime, ping, and copyright command. The latter requires bot.config['copyright_license_file'] to be set to a path to a text file, the contents of which will be sent when the user runs the copyright command.
Also contains various utilities:
codeblock
wraps text in a markdown code blockabsolute_natural_timedelta
returns an English string representing an amount of secondsnatural_timedelta
returns an English string representing the difference between two dates. This function differs fromabsolute_natural_timedelta
in that it also supports years and months.natural_rate
returns an English string representing a rate of occurence.plural
is a format object which pluralizes strings. For example:f'Found {plural(len(results)):weapon}'
natural_join
joins a sequence of strings according to English grammartimeit
is a context manager that times the code in thewith
block
bot_bin.sql
Contains SQL execution commands for asyncpg.
Requires bot.pool
to be set to either an asyncpg Connection or a ConnectionPool.
Requires the bot_bin[sql]
extra.
bot_bin.stats
Implements the guild count API for DBL, DBots, Bots For Discord, LBots, and Discord Boats.
This is configured using bot.config['tokens']['stats']
.
Each key should be a domain, e.g. bot.config['tokens']['stats']['discordbots.org']
would be the bot's DBL token.
Defines a send-stats
owner only command which sends the current guild counts to the configured APIs
and reports any errors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bot_bin-2.1.0.tar.gz
.
File metadata
- Download URL: bot_bin-2.1.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4259131c243ffaf37901a3fd8253ede25b5351f07ef1083839ef55e1a3189f5 |
|
MD5 | 42f332cfde789e316c29b9efdff96513 |
|
BLAKE2b-256 | 0035552407f30663e54c896c93d7c6444dd575657d3f9e1b5f018765f41427ec |
File details
Details for the file bot_bin-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: bot_bin-2.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f45153439f00176503da7cd40d3d00503b3b79c986204ff48471fb723dd81879 |
|
MD5 | 2037d9e99ca63cf565a0fd47cf94b8d8 |
|
BLAKE2b-256 | b083effe83cc57eb7c65a44516e25046efdba203d9a2c2e36557528b115843e1 |