1
0
Fork 0
mirror of https://github.com/myned/watcher.git synced 2024-12-23 21:07:27 +00:00
Discord bot for activity roles
Find a file
2023-03-06 21:45:09 -06:00
.github Add funding 2022-06-08 22:38:20 -05:00
commands Fix limbo index error 2023-01-04 11:47:05 -06:00
tasks Add removal of activity roles for excluded role 2022-08-16 17:38:44 -05:00
tools Add inactive command 2022-07-05 17:19:59 -05:00
.gitignore Ignore database files 2022-06-14 18:20:57 -05:00
config.py Add inactive command 2022-07-05 17:19:59 -05:00
LICENSE Initial commit 2022-06-07 16:22:48 -05:00
poetry.toml Initial upload 2022-06-08 20:59:15 -05:00
pyproject.toml Update dependencies 2023-03-06 21:09:43 -06:00
README.md Update readme 2023-03-06 21:45:09 -06:00
run.py Update hikari-miru 2023-01-04 11:46:45 -06:00
watcher.service Add systemd user service file 2023-03-06 21:10:05 -06:00

Watcher

An experimental Hikari Discord bot for assigning active and inactive roles based on member activity

ko-fi

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

Git
Python 3.10+
Poetry

Installing

  1. Clone repository
git clone https://github.com/Myned/Watcher.git
  1. Go to project folder
cd Watcher
  1. Create a virtual environment and install dependencies
poetry install

Usage

  1. Go to project folder
cd Watcher
  1. 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

  1. Go to project folder
cd Watcher
  1. Copy user service file
cp watcher.service ~/.config/systemd/user
  1. Reload user daemon
systemctl --user daemon-reload
  1. Start and enable service on login
systemctl --user enable --now watcher
  1. Enable lingering to start user services on boot
sudo loginctl enable-linger username

Updating

  1. Go to project folder
cd Watcher
  1. Pull changes from repository
git pull
  1. Update virtual environment
poetry update

Uninstalling

  1. Stop and disable systemd user service
systemctl --user disable --now watcher
  1. Remove systemd user service file
rm ~/.config/systemd/user/watcher.service
  1. Optionally disable lingering
sudo loginctl disable-linger username
  1. Remove project folder
rm -rf Watcher

Contributing

  1. Fork this repository on GitHub
  2. Make changes to the code
  3. Format the code with Black inside the project folder
    poetry run python black .
    
  4. Commit the changes to the fork
  5. Create a pull request from the fork

Credits

hikari
hikari-lightbulb
hikari-miru