How to Deploy FlawBOT
These steps build FlawBOT from source and run it on a Linux machine such as a Raspberry Pi (64-bit OS). They work the same on any other machine with the .NET runtime.
- Download the latest FlawBOT source code.
- Install the .NET 10 SDK on the machine you'll build on.
- Modify the included
src/FlawBOT/Resources/config.jsonfile with your API tokens. - Build and publish the bot.
dotnet publish src/FlawBOT/FlawBOT.csproj -c Release -o publish
- Update your Raspberry Pi to the latest version.
sudo apt-get update -y
sudo apt-get upgrade -y
- Copy the contents of the
publishfolder to the Raspberry Pi. - Install the .NET 10 runtime on the Raspberry Pi.
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 10.0 --runtime dotnet
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.bashrc
source ~/.bashrc
- Navigate to where you've copied your FlawBOT files and start the bot.
dotnet FlawBOT.dll
FlawBOT shuts down cleanly when it receives Ctrl+C or SIGTERM, so it can be run as a systemd service or in a container.
Discord application settings
In the Discord Developer Portal, invite the bot with the bot and applications.commands scopes.
FlawBOT uses slash commands only, so the Message Content Intent is not needed. Enable the Server Members Intent
if you want to use /role inrole.
Running the tests
dotnet test src/FlawBOT.sln
This runs the offline unit tests. Tests that call the real APIs are in the Live category and are skipped by default.
To run them, add your tokens to config.json or set FLAWBOT_TOKEN_<NAME> environment variables (for example FLAWBOT_TOKEN_NASA), then run:
dotnet test src/FlawBOT.sln -- NUnit.Where="cat == Live"
Live tests for APIs without a configured token are skipped.