Remaking my favorite Discord bot in Golang
-
Configure Discord's end for your bot
https://discordnet.dev/guides/getting_started/first-bot.html -
Compile Dadbot.go
go build Dadbot.go -
Run it!
./Dadbot -t DISCORD_BOT_TOKEN
Or set environment variable:export DISCORD_BOT_TOKEN=your_token_here && ./Dadbot
For production deployment, use the included systemd service file with secure environment configuration:
-
Configure environment file:
sudo cp etc-dadbot.env.example /etc/dadbot.env sudo nano /etc/dadbot.env # Add your DISCORD_BOT_TOKEN sudo chown root:dadbot /etc/dadbot.env sudo chmod 640 /etc/dadbot.env -
Deploy dad:
sudo cp DadBot /usr/local/bin/ sudo cp dadbot.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable dadbot sudo systemctl start dadbot -
Monitor logs:
# View structured JSON logs journalctl -u dadbot -f --output=json | jq . # Simple log viewing journalctl -u dadbot -f
I haven't tested this on Windows. Should work on all *.nix platforms. We push to prod without testing here 🎉


