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

pip install Simple-Notify-discord==0.1.0

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 = Simple_Notify_Discord()
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 Simple_Notify_Discord 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 Simple_Notify_Discord 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.1.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.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple_notify_discord-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e0f2332023153bb4d41ee7ac4754f40030cfc9d6d0c82dc09bffeb74c6717691
MD5 74d548e643f3c14c68facf24ca5f343b
BLAKE2b-256 c9ea06c025a110a778a023e14d8426a578076bffd03cb0f9a32d9bbf2ec735fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_notify_discord-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b0073a3d2ac472b41721a8ef194f130d070fefbabb4d3c6c8ce5d583f488080
MD5 58ea279b20567009e37ea9b0b280d2dc
BLAKE2b-256 66ad0cd02e6075b79ee06def935c748dd06d0d1e884c418087dc7e4afbff3dc3

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