Tardsquad Discord Bot

A Discord chat bot for the Tardsquad guild (Discord name for server).



Make sure to use a supported python version. See the key python in the section tool.poetry.dependencies at pyproject.toml.

$ pip install tardsquad-discord-bot
$ tardsquad-bot

If you use pipx to install, you must specify a supported and locally available python version like:

$ pipx install --python python3.9 tardsquad-discord-bot


TL;DR the easy way

Get the discord token by asking @erikw or from the bot tab in the tardsquad-discord-bot application in the Discord developer portal

$ git clone https://github.com/tardsquad/tardsquad-discord-bot.git && cd $(basename "$_" .git)
$ echo "DISCORD_TOKEN=the-token" > .env
$ docker-compose up

Continue reading for how to setup local development envionment, with our without Docker below:

More elaborate

Make sure to $ poetry shell before using tools like pyright LSP, so that it can find the installed dependency modules

Reference for how to structure a python project: https://realpython.com/pypi-publish-python-package/

Clone this git

$ git clone https://github.com/tardsquad/tardsquad-discord-bot.git
$ cd tardsquad-discord-bot

Install Poetry

$ pip install poetry

Install project dependencies

$ poetry install

Set up envionment. Fetch the bot token from the bot tab in the tardsquad-discord-bot application in the Discord developer portal. Either set this as as an envionmental variable together with the guild (server name), or more preffered in the git-ignored .env file in the project directory:

$ echo "DISCORD_TOKEN=the-token" > .env

Now tardsquad-discord-bot should work!

$ poetry run tardsquad-discord-bot

To install locally:

$ poetry build
$ pip install dist/tardsquad_discord_bot-*.whl

Build and run Docker image using the local .env file with secrets:

$ docker build -t tardsquad-discord-bot .
$ docker run --env-file=.env -t tardsquad-discord-bot
$ # or more simply
$ docker-compose up

Drop in to a shell like

$ docker run --env-file=.env --rm -it --entrypoint bash tardsquad-discord-bot


$ vi -p pyproject.toml CHANGELOG.md  # Update version.
$ poetry build
$ ls -l dist/
$ git commit -m "Prepare vX.Y.Z"
$ git tag V.X.Y.Z
$ git push --all && git push --tags
$ poetry publish
GitHub - Tardsquad/tardsquad-discord-bot at pythonawesome.com
Bot for the Tardsquad Discord guild. Contribute to Tardsquad/tardsquad-discord-bot development by creating an account on GitHub.