A discord bot to collect useful information on my discord servers, also serves as learnings and showings for my haskell language training.
To add this bot to your own server use the following link (minimum permissions are given for functionality)
- Integrates with COVID api to retrieve up to date data
- Multithreaded and quick, Botty compiles to an executable file that runs withought needing a
node,python,java,or,.netruntime - Dynamically populated
/helpcommand that is populated based on the features added to the bot
- Quirky but usable interactions, the bot will notify you immediately when it has understood your command and will let you know
- Flashpolls so users can vote on whatever they want
To compile and build this project you will need
- Haskell stack
- A discord application setup at - https://discordapp.com/developers/
- An environment variable for the bot stored in the variable
DISCORD_CLIENT_SECRET
Open the root directory in terminal or VSCode and run stack build this will pull down the GHC version this project is using and the dependencies
This project is published using gitlab ci/ci. The .gitlab-ci.yml has the build and deployment steps.
Ideally you'd want this hosted on raspberry pi, but it can be hosted on any compute service (AWS, Azure, GCP even heroku)
Compile the linux binary and upload it to your pi, setup the process within systemd google it. do it this way it will always boot on the correct stage of the boot process, you can also debug boot errors
- Create a new service in the directory
/lib/systemd/system/discord.service - make sure the linux executable is set to execute mode in the pi
- use the following template to setup the service code.
[Unit]
Description=My Sample Service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/sample.py
[Install]
WantedBy=multi-user.target- Add logging to a text file if you don't like the boot logging that comes with
systemd /home/pi/runtime > /home/pi/runtime.log 2>&1this will log error and logs
- Add the new service to the boot with the following commands
sudo systemctl daemon-reload
sudo systemctl enable sample.service- Reboot the pi. the service should be running when you start
systemctlis the tool you want to use to see running servicesjournalctlwill give you the logs of a running process
Please see the wiki for more detailed information on this project


