mirror of
https://github.com/myned/watcher.git
synced 2024-11-01 12:22:38 +00:00
Discord bot for activity roles
.github | ||
commands | ||
tasks | ||
tools | ||
.gitignore | ||
config.py | ||
LICENSE | ||
poetry.toml | ||
pyproject.toml | ||
README.md | ||
run.py | ||
watcher.service |
Watcher
An experimental Hikari Discord bot for assigning active and inactive roles based on member activity
Prerequisites
Linux is used for the following commands
WSL can be used to run Linux on Windows, but is not required to run the bot
Requirements
Installing
- Clone repository
git clone https://github.com/Myned/Watcher.git
- Go to project folder
cd Watcher
- Create a virtual environment and install dependencies
poetry install
Usage
- Go to project folder
cd Watcher
- Run with optimizations
poetry run python -OO run.py
Setup
Run to create config.toml
The file will automatically generate if it does not exist
client = 0 # bot application id
token = "" # bot token
activity = "you" # bot status
db = "watcher.db" # sqlite3 db filepath
guild = 0 # guild id to watch
active = 0 # active role id
inactive = 0 # inactive role id
duration = 0 # time in seconds before considered inactive
systemd service
Run in the background on most Linux machines
This assumes that the project folder is located at ~/.git/Watcher
Change the WorkingDirectory
path in watcher.service
if this is not the case
- Go to project folder
cd Watcher
- Copy user service file
cp watcher.service ~/.config/systemd/user
- Reload user daemon
systemctl --user daemon-reload
- Start and enable service on login
systemctl --user enable --now watcher
- Enable lingering to start user services on boot
sudo loginctl enable-linger username
Updating
- Go to project folder
cd Watcher
- Pull changes from repository
git pull
- Update virtual environment
poetry update
- Restart systemd user service
systemctl --user restart watcher
Uninstalling
- Stop and disable systemd user service
systemctl --user disable --now watcher
- Remove systemd user service file
rm ~/.config/systemd/user/watcher.service
- Optionally disable lingering
sudo loginctl disable-linger username
- Remove project folder
rm -rf Watcher
Contributing
- Fork this repository on GitHub
- Make changes to the code
- Format the code with Black inside the project folder
poetry run python black .
- Commit the changes to the fork
- Create a pull request from the fork