2023-10-10 22:22:09 +03:00
|
|
|
# Home Front Command Notificator
|
|
|
|
## A bot to send Discord notifications for HFC alerts
|
|
|
|
### Created by GaMeNu and yrrad8
|
|
|
|
|
|
|
|
> **IMPORTANT:** This bot is unofficial! Please do not rely on it alone.
|
|
|
|
|
|
|
|
## What is this?
|
|
|
|
This is a bot that connects to the HFC's servers and sends real-time notifications about alerts in Israel.
|
|
|
|
|
|
|
|
### Setup
|
2023-10-11 14:32:05 +03:00
|
|
|
Invite the bot to a server, and /register a channel, and you're ready to go!
|
|
|
|
|
|
|
|
Alternatively, you can DM the bot to receive alerts directly to your DMs!
|
2023-10-11 13:01:37 +03:00
|
|
|
|
2023-10-11 19:17:29 +03:00
|
|
|
Please do note that the bot instance listed here is hosted on a private machine, and may be a bit slow.
|
2023-10-12 01:10:59 +03:00
|
|
|
|
|
|
|
## Command documentation
|
2023-10-23 09:31:24 +03:00
|
|
|
#### /about
|
2023-10-12 01:10:59 +03:00
|
|
|
Get some info about the bot
|
2023-10-23 09:31:24 +03:00
|
|
|
#### /register
|
2023-10-12 01:10:59 +03:00
|
|
|
Run in a channel to register it to receive alerts
|
2023-10-23 09:31:24 +03:00
|
|
|
#### /unregister
|
2023-10-12 01:10:59 +03:00
|
|
|
Run in a registered channel to stop it from receiving alerts
|
2023-10-23 09:31:24 +03:00
|
|
|
#### /latest \<time\> \<unit\> \[page\]
|
2023-10-12 01:10:59 +03:00
|
|
|
Get the latest alerts from up to a certain time back.
|
|
|
|
|
2023-10-23 09:31:24 +03:00
|
|
|
### Location commands
|
|
|
|
#### /locations add \<id\>
|
|
|
|
Register a location to receive alerts from
|
|
|
|
#### /locations remove \<id\>
|
|
|
|
Remove a location to receive alerts from
|
|
|
|
#### /locations clear \<id\>
|
|
|
|
Clear all registered locations (Get alerts from everywhere)
|
|
|
|
#### /locations list \[page\]
|
|
|
|
List all valid locations
|
|
|
|
#### /locations registered \[page\]
|
|
|
|
List all registered locations
|
|
|
|
|
2023-10-10 22:22:09 +03:00
|
|
|
## Self-hosting
|
|
|
|
### Requirements
|
2023-10-11 13:01:37 +03:00
|
|
|
#### Required PyPI packages (run each with `pip install`)
|
2023-10-23 01:12:37 +03:00
|
|
|
**Note:** as of 2023-10-23, discord.py seems to not install properly for Python 3.11 and above.
|
|
|
|
The fix we've found is to first install the beta version of package `aiohttp` separately (`aiohttp==3.9.0b0`).
|
2023-10-10 22:22:09 +03:00
|
|
|
```
|
|
|
|
discord.py
|
|
|
|
mysql-connector-python
|
2023-10-22 23:41:11 +03:00
|
|
|
requests
|
2023-10-10 22:22:09 +03:00
|
|
|
python-dotenv
|
|
|
|
```
|
|
|
|
#### Other requirements
|
|
|
|
MySQL Server: https://dev.mysql.com/downloads/mysql/
|
|
|
|
|
|
|
|
### .env format:
|
|
|
|
Replace the angled brackets with the matching data
|
|
|
|
```env
|
|
|
|
TOKEN = <Discord bot token>
|
|
|
|
AUTHOR_ID = <Your Discord user ID>
|
|
|
|
|
|
|
|
DB_USERNAME = <MySQL database username>
|
|
|
|
DB_PASSWORD = <MySQL database password>
|
|
|
|
```
|
|
|
|
|
2023-10-11 13:01:37 +03:00
|
|
|
note that the .env file must be in the same directory as main.py
|
|
|
|
|
2023-10-10 22:22:09 +03:00
|
|
|
## Links
|
|
|
|
[GitHub](https://github.com/GaMeNu/HFCNotificator)
|
|
|
|
|
|
|
|
[Official Bot Invite Link](https://discord.com/api/oauth2/authorize?client_id=1160344131067977738&permissions=0&scope=applications.commands%20bot)
|
|
|
|
|
|
|
|
[Bot Profile (Use to open a Direct Message with the bot)](https://discord.com/users/1160344131067977738)
|
|
|
|
|
|
|
|
[HFC Website](https://www.oref.org.il/)
|
|
|
|
|
|
|
|
|
|
|
|
|