This Python script checks for unread Private Messages (PMs) from Gazelle-based trackers and sends notifications to a specified Discord channel via a webhook.
The script uses the Gazelle API's ajax.php?action=inbox
endpoint to fetch your private messages and checks for unread messages received within the last 60 seconds. If any are found, the script sends a notification to a Discord channel using a webhook.
-
The tracker must expose the following endpoints:
ajax.php?action=inbox
- to retrieve messages.inbox.php?action=viewconv&id=
- to view individual conversations.
-
You need a Discord webhook URL for posting notifications.
-
Python 3.x installed.
-
Install the required dependencies:
pip install requests discord-webhook
-
Gazelle Tracker API Details: Add your tracker details in the
api_sources
list inside the script, including:name
: The name of the tracker.base_url
: The base URL of the tracker.inbox_endpoint
: The API endpoint for fetching private messages (usuallyajax.php?action=inbox
).api_key
: Your tracker API key.
-
Discord Webhook URL: Set your Discord webhook URL in the
DISCORD_WEBHOOK_URL
variable inside theif __name__ == "__main__":
block.Example:
DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL"
Run the script using Python:
python gazelle_pm_notifier.py
To run the script automatically every minute, you can add it to your crontab
:
-
Open your crontab file for editing:
crontab -e
-
Add the following line to schedule the script to run every minute:
* * * * * /usr/bin/python3 /path/to/your/pmerr.py
Replace
/usr/bin/python3
with the path to your Python 3 executable, and/path/to/your/pmerr.py
with the full path to your script. -
Save and exit the editor. The script will now run every minute.
The bot sends a message to the configured Discord channel with the following details:
- PM subject
- Link to the conversation on the tracker
- Tracker source
You can add as many Gazelle-based trackers as you'd like by extending the api_sources
list with more entries.
Feel free to submit issues or pull requests for improvements.
This project is licensed under the MIT License.