Send Discord Notifications from shell or python. You can use system saved aliases for the webhook and userIDs
Project description
Discotify
Shell CLI command and python package to send messages to discord via webhooks.
Supports aliases to webhooks and user_ids saved to a platform config file.
When using the config file, shell and python share the added aliases.
Installation
You can install this package using pip:
pip install discotify
Or install from source:
git clone https://github.com/yvvidolov/discotify.git
cd discotify
pip install -e .
Usage
Using the command line tool
discotify --help
discotify --user_add my_user 694462935761677102
discotify --hook_add my_channel https://discord.com/api/webhooks/1423340029622751367/rx-ibr-lVxAhFIUWs2
discotify --channel my_channel --mention my_user "Hello Discord!!!"
Using as a Python module
from discotify import Discotify
dis = Discotify(tag='HomeServer', channels='my_channel')
dis.send(text="This is me message", mentions='my_user')
dis.get_config_path() # filepath to config.json containing the user/hook aliases
dis.get_users_alias() # return dictionary of alias/user_id
dis.get_hooks_alias() # return dictionary of alias/hook_url
dis.user_add(alias='short', user_id='discord_user_id') # add new user_id alias
dis.user_remove(alias='short') # remove by alias
dis.user_remove(user_id='short') # remove by user_id
Discotify(
tag: Optional[str] = None, # add a [tag] before the message
mentions: Optional[List[str]|str] = None, # add @username for notifications
channels: Optional[List[str]|str] = None, # send to multiple channels/webhooks
username: str = "PythonBot", # the username of the sending bot
no_config_file: bool = False, # do not read/write platform config.json (slightly faster)
custom_config_file: Optional[str] = None # override the config file path/name
)
Getting discord webhook and user_id
WebHook
- Open: discord.com
- Select channel -> Edit Channel
- Integrations -> Webhooks -> New Webhook -> Copy Webhook URL
UserID
- Open: discord.com
- User Settings -> Advanced -> Developer Mode
- Right click User -> Copy User ID
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discotify-1.0.0.tar.gz.
File metadata
- Download URL: discotify-1.0.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53aae0ae6fd72d3eecd9c9fc4264448b65fa2c05e9d961560350496146e3ad1a
|
|
| MD5 |
4e03622fe806f8991e2a6f264dd67368
|
|
| BLAKE2b-256 |
e6e321425c6d17619e5461683ca2d26c1255b1ed15ce11e14bca525d02f69ee6
|
File details
Details for the file discotify-1.0.0-py3-none-any.whl.
File metadata
- Download URL: discotify-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fe1aef90acd0b7579cdadf817bf52bf8bb74b6654ae07afbdada3e9d2aae304
|
|
| MD5 |
6cd36466bccec5abe687d37a67d42976
|
|
| BLAKE2b-256 |
20cbb11832ef2c1e099e1529277a1aa17f7fcdf9b4ab00f4c8faa5b7200cc010
|