Skip to content

Releases: Trimatix/BASED

v0.8-beta

29 May 10:26
a0e6f2a
Compare
Choose a tag to compare
v0.8-beta Pre-release
Pre-release

The main changes in this release are:

  • switch from flatfile json to sql
  • switch from text commands and mainly reaction menus to slash commands and mainly components

What's Changed

Full Changelog: v0.5-alpha...v0.8-beta

dynamic scheduling

23 May 22:42
Compare
Choose a tag to compare
dynamic scheduling Pre-release
Pre-release
  1. Central dynamic scheduler
    The biggest change in this update is the start of moving from multiple task schedulers to a single scheduler. You can still use task references, but you should not rely on maintaining multiple schedulers to keep track of your tasks.
    v0.5 also adds the new "dynamic" scheduler, which automatically yields its thread until the soonest-expiring timedtask is due to expire. In essence, AutoCheckingTimedTaskHeap is an interrupts-based scheduler, whereas TimedTaskHeap can be seen as polling-based. It will also handle its own task expiry thread, meaning you don't need to have a main loop in your client.

  2. Configurator timeouts
    the timeouts config variable is now special-cased to allow for multi-level serialization. The configurator module, and this special-cased variable, are both planned to be overhauled and separated into a separate package.

  3. Run scripts removed
    BASED no longer supports code deployment with git out of the box. This means that run scripts are now obsolete, and automatic restarting should instead be handled by your container software. In accordance, the restart and update commands have also been removed.

  4. SaveableMenu decorator
    Relying on a public class attribute for menu saveability was not a viable long-term solution. Any class saveable attributes will now be completely disregarded, and can be removed unless you have your own behaviour which uses them. Instead, reaction menus are now marked as saveable using the new reactionMenu.saveableMenu class decorator. Simply placing this decorator before your subclass declaration will set up your menu type for serializing and deserializing, with no extra input needed, other than the implementations of serializer methods toDict and fromDict. You may also wish to check the new utility functions in reactionMenu.py, being isSaveableMenuClass, isSaveableMenuInstance, isSaveableMenuTypeName, and saveableMenuClassFromName. Unfortunately, to allow for portability, classes are identified ENTIRELy by their names. As such, attempting to register two reactionMenu subclasses with the same name as saveable is not supported.

  5. Updated emoji support
    BASED now supports the latest version of the emoji library. This was original handled by specifying an emoji library, but has since been changed to use emoji's built-in regex. The regional indicator emojis (🇦, 🇧, 🇨...), which are accepted by discord emojis but are not registered as emojis under the emoji consortium, will not be accepted into the emoji library standard, and have instead been special-cased. For details, see the PR here. Finally, emoji display mode indicators are now special-cased and stripped as well. This fixes false-negatives with emojis such as ⚒. I imagine more invisible characters such as this will need to be added in the future.

Misc

  • fix erroneous exception swallowing when importing commands modules
  • fix BasedEmoji.fromReaction references in SingleUserReactionMenu.doMenu
  • added draft tox.ini with a few PEP standards ignored to align with my personal code style

compliance

20 Jan 23:18
Compare
Choose a tag to compare
compliance Pre-release
Pre-release

This update adds a myriad of tweaks and reformatting, to fix hundreds of cases of standards misalignment;
for example, the entire codebase has been reformatted to align with PEP standards MUCH better - bringing violations down from 837 to 239 - and hundreds of code smells, as detected by sonarcloud, have been cleaned up.

This update also brings a fix to a major bug, in which adding a custom emoji reaction to a reaction menu could crash the menu, if the emoji is not accessible to the bot. This was an exceptionally large issue with inline menus.

hotfix: defaultEmoji initialization

09 Jan 17:38
Compare
Choose a tag to compare
Pre-release

Fix defaultEmoji config vars not being initialized properly from UninitializedBasedEmoji, due to new ConfigProxy typing.

configs

09 Jan 15:26
d117660
Compare
Choose a tag to compare
configs Pre-release
Pre-release

This update adds the ability to configure all of the bot's cfg attributes externally with toml.

  • To run the bot with your config, pass it through command-line arguments. e.g: python3 main.py path-to-config.toml
    • This path can be either absolute, or relative to the project root directory.
  • All config variables are optional.
  • Any emoji variable can be either unicode or custom.
    • give custom emojis as the emoji ID, or unicode emojis as a string containing a single unicode emoji character.
  • A default config file containing all configurable variables and their default values can be generated by running makeDefaultConfig.py.
  • The bot token can now be given in a config variable, or in an environment variable whose name is specified in config.
    • To give your token directly in the config file, specify it in the botToken config var.
    • To give your token in an environment variable, give the name of the environment variable in the botToken_envVarName
    • You must give exactly one of these variables.

With the addition of the required config variables botToken and botToken_envVarName, a toml config file is now indirectly a requirement to launch the bot. This can be changed by providing your token in the attributes in the cfg python module. If one of cfg.botToken or botToken_envVarName is present, the config file command line argument becomes optional.

This update also brings two looping bot launching scripts, run.bat and run.sh.

By launching your bot from a run script, dev_cmd_restart becomes functional. This command will restart the script. The run script will also restart your bot if critical errors are encountered, crashing the bot.

By giving the -g argument to a run script, dev_cmd_update becomes functional. ONLY specify -g if you have git installed on your system, and your bot is in a git tree.

Running dev_cmd_update will shut down the bot, run git pull, and restart the bot again. If conflicts are encountered with merging commits, the pull will be cancelled entirely. This error will not be announced to discord, and you should check your console after running dev_cmd_update to ensure that it was successful (or implement your own bot version checking command)

ping

05 Jan 20:43
Compare
Choose a tag to compare
ping Pre-release
Pre-release

Minor update fixes and small features:

  • BasedEmoji.eq now directly compares sendables and nothing else
  • added admin_cmd_ping
  • BasedClient now uses the members intent by default. Make sure you enable the members intent in the "bot" page of your application's setup: https://discord.com/developers/applications
  • added InlineConfirmationMenu

Useable

06 Dec 14:31
Compare
Choose a tag to compare
Useable Pre-release
Pre-release

Add BASED version checking with git. A personal GitHub access token is no longer required.
on_reaction events overhaul that's far more efficient than before.
Remove all bountybot references.
Reformat the built in source command.

Initial draft

04 Dec 16:57
da5c16d
Compare
Choose a tag to compare
Initial draft Pre-release
Pre-release

This version is a simple copy-over of code written in GOF2BountyBot.
The codebase is likely to change rapidly during the early stages of BASED development.