Skip to content

configs

Pre-release
Pre-release
Compare
Choose a tag to compare
@Trimatix Trimatix released this 09 Jan 15:26
· 447 commits to master since this release
d117660

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)