Python 3.10 Windows 10/11
Tip
We recommend downloading the latest release to avoid bugs.
- Open the repository:
cd /path/to/repository - Create a new virtual environment:
python -m venv .venv - Activate the virtual environment:
source .venv/bin/activate - Update pip:
pip install --upgrade pip - Download packages:
pip install -r requirements.txt
Information about how to create bot and get token can be found here.
Caution
This program is for personal use only. Do not share your tokens or text channel IDs with anyone.
First, we import snitch application. After that we call run method with properties.
Note
You can choose the channel to which event(s) will be sent or even ignore some type of event(s), according to your preference.
from snitch import *
Snitch.run(properties={
"USER_REPO": "YOUR USERNAME/REPOSITORY HERE (REQUIRED) (EXAMPLE: GimmyFimmy/Snitch)",
"GITHUB_TOKEN": "YOUR TOKEN HERE (REQUIRED)",
"BOT_TOKEN": "YOUR TOKEN HERE (REQUIRED)",
"PUSH_CHANNEL_ID": "YOUR CHANNEL ID HERE",
"PULL_REQUEST_CHANNEL_ID": "YOUR CHANNEL ID HERE",
"RELEASE_CHANNEL_ID": "YOUR CHANNEL ID HERE",
"ISSUES_CHANNEL_ID": "YOUR CHANNEL ID HERE",
})You can also change types of events, their titles and descriptions in a snitch/snitch.py file. This is how it looks:
_SAMPLES = {
"push": {
"title": "↗ Push from {data[pusher][name]}",
"desc": "`Commit Messages: {data[head_commit][message]}`\n`Forced: {data[forced]}`",
},
"pull_request": {
"title": "⤵ {data[pull_request][title]} was *{data[action]}* by {data[sender][login]}",
"desc": "`Number: {data[number]}`",
},
"release": {
"title": "⬇ {data[release][name]} was *{data[action]}* by {data[release][author][login]}",
"desc": "`Pre Release: {data[release][prerelease]}`\n`Id: {data[release][id]}`",
},
"issues": {
"title": "⚠ {data[issue][title]} was *{data[action]}* by {data[issue][user][login]}",
"desc": "`Id: {data[issue][id]}`",
},
}Note
To access event data use {data[...]}, to go to the next line use \n.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
