Skip to main content

discordwebhlok is a python library for discord webhook with discord rest api on Python 3.6 and above.

Project description

discordwebhook

PyPI License: MIT codecov Build Status PyPI - Python Version Downloads

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.png

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&amp;v=4"
)

basic-username.png

basic embed

from discordwebhook import Discord

discord = Discord(url="<your webhook url>")
discord.post(
    embeds=[{"title": "Embed Title", "description": "Embed description"}],
)

basic-embed.png

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",
            },
        }
    ],
)

advanced-embed.png

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"),
    },
)

send-file.png

Getting started

For help getting started with discord webhook, view our online documentation.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

discordwebhook-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file discordwebhook-1.0.0.tar.gz.

File metadata

  • Download URL: discordwebhook-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.4

File hashes

Hashes for discordwebhook-1.0.0.tar.gz
Algorithm Hash digest
SHA256 de86330054f1256e69d3db4b739c038533dd76be07e7dba8d5da2abe79e1e06f
MD5 3fe046522d9a6122c91ca9f19cebf093
BLAKE2b-256 283a273cfb1a3f53eabb7765be04ce8f73b21c5670ab5cf9fc3eaf3b6483de31

See more details on using hashes here.

File details

Details for the file discordwebhook-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: discordwebhook-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.4

File hashes

Hashes for discordwebhook-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3abc32ec1d48dedefb5547b7b4de907c7ecefda65ef27664d0ee5508bb3ac6f5
MD5 43f76d924cdcfe83ba506393a445e26b
BLAKE2b-256 d1dc8a11038d43e8ecc51f6ba1403bb057e7b03035dcda9189ca14c310d58a84

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