Skip to main content

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 block
  • absolute_natural_timedelta returns an English string representing an amount of seconds
  • natural_timedelta returns an English string representing the difference between two dates. This function differs from absolute_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 grammar
  • timeit is a context manager that times the code in the with 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bot-bin-1.6.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bot_bin-1.6.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file bot-bin-1.6.0.tar.gz.

File metadata

  • Download URL: bot-bin-1.6.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for bot-bin-1.6.0.tar.gz
Algorithm Hash digest
SHA256 1aa9c1cfc8ee181e2ebd4ee111d006e37c6267fe38567b70b7454d6d6626a2ed
MD5 1b79f94fbccd31bca33d5d0e2132e8c3
BLAKE2b-256 de9114373d04a4487a1efff95e8ed0150adf17a492feab1b71f3b1d494c527ae

See more details on using hashes here.

File details

Details for the file bot_bin-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: bot_bin-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for bot_bin-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99a90e9dde7a1e47a793779316a39355939bc0e7a0ccb256c0611e06a833e6e0
MD5 beaadd8c22229dfd1529202775313a7f
BLAKE2b-256 16be83acbcc00e56148f052f510b4379d41b4dac58d32f0b7589f1b8f6f2f3fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page