Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mccreery/bots
A collection of Discord bots written in Python using the library discord.py.
https://github.com/mccreery/bots
Last synced: about 2 months ago
JSON representation
A collection of Discord bots written in Python using the library discord.py.
- Host: GitHub
- URL: https://github.com/mccreery/bots
- Owner: mccreery
- Created: 2017-10-30T01:28:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T23:14:32.000Z (7 months ago)
- Last Synced: 2024-10-13T06:23:46.428Z (3 months ago)
- Language: Python
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Discord Bots
Lots of Python bots for [Discord](https://discordapp.com/)
## [`wrapper.py`](wrapper.py)
The wrapper code provides some common functionality for the most common type of
bot which runs commands. It uses the following environment variables:- `BOT_CONFIG` (default `"config.ini"`): The config file for looking up secrets
- `BOT_PREFIX` (default `"!"`): The command prefix
- `BOT_TOKEN`: Overrides the first argument to `wrapper.run``wrapper.run` finds the appropriate token and runs the bot. Before running, it
will try to use the token as a key in the config file section `Tokens`. For
example, if the config file looks like:
```ini
[Tokens]
my_bot=XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXX
```
Then the following are all equivalent:
```bash
BOT_TOKEN=XX...X python -c 'import wrapper; wrapper.run()' # Token in env
BOT_TOKEN=my_bot python -c 'import wrapper; wrapper.run()' # Key in env
python -c 'import wrapper; wrapper.run("XX...X")' # Token in run()
python -c 'import wrapper; wrapper.run("my_bot")' # Key in run()
```
You can verify this by seeing your bot come online.