discordwebhlok is a python library for discord webhook with discord rest api on Python 3.6 and above.
Project description
discordwebhook
discordwebhook is a python library for discord webhook with discord rest api on Python 3.6 and above.
Installation
$ pip install discordwebhook
Usage
basic
from discordwebhook import Discord
discord = Discord(url="<your webhook url>")
discord.post(content="Hello, world.")
basic, username and avatar_url
from discordwebhook import Discord
discord = Discord(url="<your webhook url>")
discord.post(
content="Hello, world.",
username="10mohi6",
avatar_url="https://avatars2.githubusercontent.com/u/38859131?s=460&v=4"
)
basic embed
from discordwebhook import Discord
discord = Discord(url="<your webhook url>")
discord.post(
embeds=[{"title": "Embed Title", "description": "Embed description"}],
)
advanced embed
from discordwebhook import Discord
discord = Discord(url="<your webhook url>")
discord.post(
embeds=[
{
"author": {
"name": "Embed Name",
"url": "https://github.com/10mohi6/discord-webhook-python",
"icon_url": "https://picsum.photos/24/24",
},
"title": "Embed Title",
"description": "Embed description",
"fields": [
{"name": "Field Name 1", "value": "Value 1", "inline": True},
{"name": "Field Name 2", "value": "Value 2", "inline": True},
{"name": "Field Name 3", "value": "Field Value 3"},
],
"thumbnail": {"url": "https://picsum.photos/80/60"},
"image": {"url": "https://picsum.photos/400/300"},
"footer": {
"text": "Embed Footer",
"icon_url": "https://picsum.photos/20/20",
},
}
],
)
send file
from discordwebhook import Discord
discord = Discord(url="<your webhook url>")
discord.post(
file={
"file1": open("tests/file1.jpg", "rb"),
"file2": open("tests/file2.jpg", "rb"),
},
)
Getting started
For help getting started with discord webhook, view our online documentation.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
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
discordwebhook-1.0.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for discordwebhook-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15c23e242c3db15da639bdaa87d0949f02ddfb90ddb10bc123e16be19574881f |
|
MD5 | 6cf1a7a9fbaf58d65f757d4abc612d06 |
|
BLAKE2b-256 | 032f7cbb7a8fd211cd6dcd27063d4bafb810e7e83e1fc35e46d28a27742010a1 |