mirror of https://gitgud.io/fatchan/globalafk
parent
137644ec4a
commit
a05cf3cfe0
7 changed files with 47 additions and 21 deletions
@ -1,19 +1,28 @@ |
||||
# globalafk |
||||
A simple python script that sends ugly notifications when something happens on a jschan imageboard that you moderate. |
||||
A python script that sends ugly notifications when something happens on a [*jschan*](https://gitgud.io/fatchan/jschan) imageboard that you moderate. |
||||
It has been developed around composition principles in order to help you to expand or change it to fit your needs and goals. Most of the components are easily swappable. |
||||
|
||||
## Features |
||||
For now, this project has one (1) basic feature, send notifications. |
||||
That said, you can configure it to send notifications when: |
||||
- New reports |
||||
- A new post includes some fine-grained pre-configured entry or some (clear or partially obfuscated) url that you have not whitelisted |
||||
|
||||
All of these features can be turned off independently. |
||||
|
||||
## Requirements |
||||
A *Global Staff* account is obviously required. |
||||
You need to have **moderation privileges** in at least one board and an environment with **python3** and **the dependencies listed in [*requirements.txt*](./requirements.txt) file** in order to run this script. |
||||
|
||||
### Linux |
||||
You must have **notify-send** installed to receive notifications on linux. |
||||
To send notifications on Linux you must have **notify-send** installed to receive notifications on linux. |
||||
Run `notify-send test` to test it. |
||||
|
||||
### Termux (Android) |
||||
You must have **Termux:API** installed to receive notifications on android. |
||||
To send notifications on Android (assuming you are using [*Termux*](https://termux.com/)) you must have **Termux:API** installed to receive notifications on android. |
||||
Run `termux-notification --title test` to test it. |
||||
|
||||
## Getting Started |
||||
1) (Optional) Create and activate a virtual environment |
||||
2) Run `pip3 install -r requirements.txt` to install the dependencies |
||||
3) Make a copy of [*config_example.py*](./config/config_example.py) and rename it to *config.py* |
||||
4) Run `python3 main.py` |
||||
3) Install (if is not already installed) *notify-send* or *termux-notification* accordingly to your needs |
||||
4) Make a copy of [*config_example.py*](./config/config_example.py) and rename it to *config.py* |
||||
5) Fill the account details and configure the script behavior in your new *config.py* file |
||||
6) Run `python3 main.py` |
||||
|
@ -0,0 +1,18 @@ |
||||
import subprocess |
||||
from abc import ABC, abstractmethod |
||||
|
||||
|
||||
class Notifier(ABC): |
||||
@abstractmethod |
||||
def notify(self, title, content, *args, **kwargs): |
||||
raise NotImplementedError |
||||
|
||||
|
||||
class TermuxNotifier(Notifier): |
||||
def notify(self, title, content, *args, **kwargs): |
||||
subprocess.call(['termux-notification', '--title', title, '--content', content]) |
||||
|
||||
|
||||
class NotifySendNotifier(Notifier): |
||||
def notify(self, title, content, *args, **kwargs): |
||||
subprocess.call(['notify-send', title, content]) |
Loading…
Reference in new issue