Skip to main content

Simple-Notify-discord allows you to simply send a message on Discord via a webhook, it allows you to alert when a process is finished or other depending on your context.

Project description

Simple-Notify-discord

Simple-Notify-discord allows you to easily send a message to a Discord channel via a webhook.
You can use it to alert when a process is finished, when an error occurs, or for any other context where you need simple notifications.

Installation

(Coming soon after publishing to PyPI)

Usage

First, set up the Simple-Notify-discord class:

import requests

class Notify:
    def __init__(self):
        self.webhook_url = "your webhook URL here"
        self.user_id = "your Discord user ID here"

    def Simple_Notify_discord(self, message="Hey this is a notification from Notify", mention=False):
        if mention:
            message = self.user_id + message
        data = {
            "content": message
        }
        response = requests.post(self.webhook_url, json=data)
        if response.status_code == 204:
            print("✅ Notification Discord sent successfully")
        else:
            print("❌ Error:", response.text)

Example

notifier = Notify()
notifier.notify_discord("✅ Your task is complete!", mention=True)

If you set mention=True, the user ID will be mentioned at the beginning of the message.


Setup

1. Create a Discord Webhook

  • Go to your Discord server.
  • Click on the server settingsIntegrationsWebhooks.
  • Click New Webhook.
  • Choose the channel where the messages will be sent.
  • Copy the webhook URL and paste it into your Notify class (self.webhook_url).

2. Find your Discord User ID

If you want the bot to mention you:

  • Enable Developer Mode in Discord settings (Settings → Advanced → Developer Mode).
  • Right-click on your profile and select Copy ID.
  • Paste this ID into your Notify class (self.user_id).

License

This project is licensed under the MIT License.
See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_notify_discord-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_notify_discord-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file simple_notify_discord-0.1.0.tar.gz.

File metadata

  • Download URL: simple_notify_discord-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for simple_notify_discord-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dff3eeef6fc24b78a9bd39bdac1433524f811f0729af67a21a2ea4842f61eade
MD5 924d5baac720348249fa2c5a815be9da
BLAKE2b-256 a12aa031f4ce24be5109f4a5683cf52afb45643b6e3ae8b19bd805df748b220c

See more details on using hashes here.

File details

Details for the file simple_notify_discord-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_notify_discord-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74b338c01720ce54c0be54857e770fb9ca3f3c8faecab23d31e8fbadd17005a3
MD5 6bc0591779b7fa5aabe8c97a96ef5065
BLAKE2b-256 eaeef94f0647683d246e95efb55faa9d7f5f5e3eadff394eae7af299059196ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page