Skip to content

Staging for 3.1.0 / API 0.1.0

Aaron Graubert requested to merge staging-3.1.0 into master

API Changes

  • Paved the way for complex, multi-sharded bots. Created a Controller interface with one concrete implementation, DummyControlInterface. The Dummy controller implements the same logic that the API used to, intended to preserve current behavior while an API is opened for more complex controllers
  • Improved Error handling. Added client.trace() to generate a traceID which is recorded in the database. Traces are meant to help simplify debugging, by providing a unique identifier which can link a user's discord error message, database entry, and log-line.
  • Added trace and logs to nearly anywhere an exception can break out of a feature's handler.
  • Added RegexType transformer
  • Reworked the API to allow for multi-guild bots. Primary_guild mode can still be enabled in the Dummy controller, but the API is no longer built to expect that to be the case
    • client.fetch_guild(name, guild_id) now takes a guild_id argument. Channel references are now defined as a nested dictionary: reference name -> guild ID -> channel ID
    • client.get_value(key, guild_id) and client.set_value(key, value, guild_id) now take optional guild_id arguments. This enables a global key-value store as well as guild stores
    • Added internal checks for suite and command status. Future controllers will implement the ability to toggle suites/commands/context menus in each guild. Suites can now force-enable themselves, but this should be used sparingly (ie: APIEssentials is force-enabled because the client relies on its features)
    • Moved client.config_get() to client.controller.config_get() and made it a coroutine
    • Improved shutdown handling. client.shutdown() can now accept an asyncio Event object which is used to inform the controller of a clean shutdown
    • Database tables must now be explicitly marked as global. Regular tables are assumed to be per-guild, and must include a guild_id attribute. This is used to enforce access control for the /viewdb command
  • Fixed a race condition in the future dispatch system which can lead to double-dispatches when events are scheduled in the past

Production Changes

  • Reworked some commands to account for new database guild-scopes
    • The /birthday command has heavily changed logic to allow users to have one global birthday, but opt-in/out of announcements in specific guilds
    • Tokens are now tracked per-guild to prevent users from creating their own guilds and paying themselves tokens
    • /gamba and context menus are reworked to interact with guild-specific token balances
    • /poll has altered logic to track polls given new database structure
    • /viewdb will only query against guild-scope databases
  • Added /roll command to roll dice. This command is currently an MVP and is marked for future improvement
  • Fixed the /timer and /reminder commands not working in DMs
Edited by Aaron Graubert

Merge request reports