Skip to main content

A simple Python library for Discord webhooks

Project description

discord-webhookspy

discord-webhookspy is a Python library for Discord webhooks make to easy.

Installation

Use the package manager pip to install foobar.

pip install discord-webhookspy

Usage

from discord_webhookspy import Webhook

# Your webhook url
webhook_url = 'https://discord.com/api/webhooks/blabla/blalblabla'

# Sets the webhook
webhook = Webhook(webhook_url)

# Changes the your webhook name return 'My Bot'
webhook.username('My Bot')

# Content about what you wanna send return 'test'
webhook.content('Bu bir test mesajıdır.') 

# Webhook avatar pfp just url returns
webhook.avatar('https://example.com/avatar.png')

# Fields but you need to add embed first and you can use this infinity.
webhook.field('Field 1', 'Value 1', inline=True)
webhook.field('Field 2', 'Value 2', inline=False)

# Returns webhook embed
webhook.embed(
    title="Webhook Title",
    color=Webhook.Color.blue(),  # Color code (you can use any color decimal like 255)
    desc="Description text",
    author="Webhook Author",
    image="https://example.com/image.png",
    thumb="https://example.com/thumb.png",
    footerText="Footer Text",
    footerUrl="https://example.com/footer-icon.png"
)

# Send webhook response
response = webhook.send()

# Check the response
if response.status_code == 204:
    print("Webhook sended succesfully")
else:
    print(f"Webhook error: {response.status_code}")

License

MIT License

Copyright (c) [2024] [ialperens]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

discord-webhookspy-1.1.1.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file discord-webhookspy-1.1.1.tar.gz.

File metadata

  • Download URL: discord-webhookspy-1.1.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for discord-webhookspy-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d50896912ac67ec50032f1f760a59b63f33807b05722c5af1896ceab3cbe06b6
MD5 0cd7e75c7992397b9cf25e05f7d4a8a4
BLAKE2b-256 6a93e57b2cdf9d46571d648dd9f05f67d5f31ef7ec11b3f354761233804d4a69

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