|
11 months ago | |
---|---|---|
config | 11 months ago | |
lib | 11 months ago | |
.gitignore | 11 months ago | |
Dockerfile | 11 months ago | |
Dockerfile_report | 11 months ago | |
Pipfile | 11 months ago | |
README.md | 11 months ago | |
covid_bot.py | 11 months ago | |
covid_report.py | 11 months ago | |
docker-compose.yml | 11 months ago |
README.md
COVID-19 Discord Bot
It's just reporting some numbers and stats from https://www.worldometers.info/coronavirus/
Configuration
You should copy the template_config.json
from the config/
directory of this project to config/config.json
and modify the values present.
You should also create a file called pgdb.key
in the config/
directory with one line defining the password to be used for the database.
If you're using the docker-compose setup, which I highly recommend, you should only need to worry about the following variables:
- api_key
- report_channel_id
- report_timezones
- report_selections
- report_top_number
api_key
Follow the link in the template config to learn how to set up a bot user with Discord's API. Then put the api_key value in place of that URL in the config.
report_channel_id
This ID specifies the channel you want the bot to send periodic reports to. You can get that ID by enabling developer mode in Discord, right clicking the channel you want to report to, and clicking "Copy ID"
report_timezones
This shouldn't be a plural variable but here we are.
This variable sets the timezone that the reporter will use to determine what times to give reports at.
report_times
This is an array of numbers in military time specifying the times the bot is to send a report to the specified channel.
report_selections
This is an array of strings that specified which selections from the table to include data from in the report.
report_top_number
The report will also include a "ranking" of the number of cases per selection. This specifies how many from the top number of cases will be shown.
Ex: 5 will show the top 5 cases currently.
Setup
Please for the love of god just use the docker-compose.yml
because I don't want to explain how to set up pipenv
and postgres
again.
docker-compose.yml
You should be in the root directory of this project and issue:
sudo docker-compose up --build -d
That will build the images for the containers needed and start the cluster.
Usage
The bot does two things:
- send periodic reports to a specified channel
- respond to commands with speified data
Reports
Using the values specified in the config file, the bot will generate reports from the data that has most recently been parsed and send that information as a report to the specified channel. It should by default look something like this:
Selection: USA
Total Cases: 311,357
New Cases: 34,196
Total Deaths: 8,452
New Deaths: 1,048
Total Recovered: 14,741
Active Cases: 288,164
Serious Critical: 8,206
Total Cases / One Mil: 941
Selection: Total
Total Cases: 1,201,473
New Cases: 84,812
Total Deaths: 64,691
New Deaths: 5,517
Total Recovered: 246,383
Active Cases: 890,399
Serious Critical: 42,288
Total Cases / One Mil: 154.1
# 1
USA: 311,357
# 2
Spain: 126,168
# 3
Italy: 124,632
# 4
Germany: 96,092
# 5
France: 89,953
Commands
All commands are appended with !
. For example, if I want to use the report
command I would say !report [selection]
.
!report
This command takes the second argument as a selection from the table. As an example, here is something similar to the response you would get for sending !report taiwan
:
Selection: Taiwan
Total Cases: 355
New Cases: 7
Total Deaths: 5
New Deaths:
Total Recovered: 50
Active Cases: 300
Serious Critical:
Total Cases / One Mil: 15
!top
This command takes hte second argument as the number of top selections to report cases of. For example, at the time of writing the command !top 5
would produce:
# 1
USA: 311,357
# 2
Spain: 126,168
# 3
Italy: 124,632
# 4
Germany: 96,092
# 5
France: 89,953
Contact
If you have any questions or need help setting up (or want to report a bug), you can contact me in the following places most effectively:
Discord: shadow8t4#8276
Telegram: @shadow8t4
Matrix: @shadow8t4:matrix.werefox.dev