Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Latest commit

 

History

History
executable file
·
67 lines (49 loc) · 2.49 KB

README.md

File metadata and controls

executable file
·
67 lines (49 loc) · 2.49 KB
Image of Buttercup, from 1998's Powerpuff Girls

buttercup

Code style: black

Discord keeper extraordinaire!

Responsible for display name enforcement and whatever else comes her way, Buttercup is a python bot running on Discord.py.

Running Buttercup

In order to run buttercup, poetry is used to manage and install dependencies.

Apart from this, a .toml configuration file is expected. Below is a default config.toml:

[Discord]
token = "<YOUR DISCORD BOT SECRET HERE>"
# Used for admin command permissions
guilds = [
    { id = "<guild_id>", mod_roles = ["<role_id>"] },
]

[Reddit]
client_id = "<YOUR REDDIT CLIENT ID HERE>"
client_secret = "<YOUR REDDIT CLIENT SECRET HERE>"
user_agent = "grafeas.org.buttercup:v0.1.0 (contact u/<YOUR USERNAME HERE>)"

[Blossom]
email = ""
password = ""
api_key = ""

[NameValidator]
verified_role_id = "<role_id>"

The secrets section contains all secrets required to run Buttercup:

  • discord is Discord's bot secret

The guild section currently contains only the Discord server's name, to make sure the bot connects to the correct server. The other sections are related to the identically named cogs. The documentation of these options can be found within the source code.

main.py can then be ran to initialize Buttercup.

Development

[coming soon]

Adding new functionality

[coming soon]

Pre-commits

Buttercup uses pre-commit to help us keep everything clean. After you check out the repo and run poetry install, run pre-commit install to configure the system. The first time that you run git commit, it will create a small venv specifically for checking commits based on our toolset. All of these are installed as part of the regular project so that you can run them as you go -- don't get taken by surprise when you go to commit! The toolchain as written invokes the following tools:

  • seed-isort-config
    • This sets .isort.cfg with all of the third-party modules that are in use.
  • isort
    • Searches Python files for imports that are in the wrong order, then offers you the option of fixing them.
  • black
    • Opinionated code formatter; automatically fixes issues.
  • flake8
    • formatting checker and linter; does not automatically fix issues.