Skip to main content

Python package to interact with Discord webhooks

Project description

Happyhooks

Happyhooks is a Python package that simplifies interaction between Discord webhooks!
You can do things in this package such as:

  1. Send/Edit/Delete messages
  2. Create Discord embeds
  3. Send files/attachments too!

Happyhooks is also asynchronous, using the aiohttp Python library so this doesn't block your whole script, and lets you also use this in Python libraries like discord.py!

Usage Examples

Here are some quick examples on how you can use this package:

  • Sending normal text messages:
import hphooks

# Assuming the rest is in an async function!
webhook = hphooks.Webhook('YOUR_WEBHOOK_URL')

await webhook.send('Hello world!') # Quick shortcut I made for basic text messages!
  • Sending basic / rich Discord embeds:
import hphooks

webhook = hphooks.Webhook('YOUR_WEBHOOK_URL')

embed = hphooks.Embed(
    title='My **COOL** embed😎',
    description='This is my very cool embed😎😎',
    color='COLOR_HEXCODE' # Defaults to #ffffff (White)!
)
rich_embed = hphooks.RichEmbed(
    title='My **COOLER** embed😎',
    url='https://example.com', # Adds a link that opens when you click the embed title!
    description='This is my more cooler embed😎😎',
    color='COLOR_HEXCODE'
)
rich_embed.set_footer('Happyhooks Rich Embed', icon_url='YOUR_IMAGE_URL')
rich_embed.set_author('Happyhooks', url='https://discord.com', icon_url='YOUR_IMAGE_URL')

rich_embed.add_field(
    name='My field',
    value='This is my field!',
    inline=True
)

message = hphooks.Message('Look at my embeds!', embeds=[embed, rich_embed])
await webhook.send(message)
  • Sending Discord attachments:
import hphooks

webhook = hphooks.Webhook('YOUR_WEBHOOK_URL')

example_image = hphooks.File(fp='your/image/file/path (will be pathlibbed)', filename='example.png')
message = hphooks.Message('Look at my image file!')
await webhook.send(message, files=[example_image])
  • Editing / Deleting webhook messages:
import hphooks
import asyncio

webhook = hphooks.Webhook('YOUR_WEBHOOK_URL')

sentmessage = await webhook.send('Example') # This returns a SentMessage object, and it'll be very important here!
print('Sent first message, editing it in a few seconds..')

await asyncio.sleep(2.0)

await webhook.edit(sentmessage, 'Edited example!') # Shortcut for only editing the content itself too!
print('Edited message! Now deleting in a few seconds..')

await asyncio.sleep(2.0)

await webhook.delete(sentmessage) # Ofcourse, deletes the webhook message!
print('Deleted message!')

All coded by me, slightly debugged by AI

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

happyhooks-0.1.1.tar.gz (104.6 kB view details)

Uploaded Source

Built Distribution

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

happyhooks-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: happyhooks-0.1.1.tar.gz
  • Upload date:
  • Size: 104.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.5"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.20 7 Apr 2026","python":"3.14.5","system":{"name":"Windows","release":"10"}} HTTPX2/2.5.0

File hashes

Hashes for happyhooks-0.1.1.tar.gz
Algorithm Hash digest
SHA256 79e67d3260c471a28edd104c56fc90c96cb6160ab72c6bff59d0508caa6fd633
MD5 0af36cf56a9b3911d7169aca019af8cb
BLAKE2b-256 2e434dbb4b5ffdf6cc60dda9c3d018e1072dc463ad5008890033573b23333439

See more details on using hashes here.

File details

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

File metadata

  • Download URL: happyhooks-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.5"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.20 7 Apr 2026","python":"3.14.5","system":{"name":"Windows","release":"10"}} HTTPX2/2.5.0

File hashes

Hashes for happyhooks-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba45aa2244c88290d5c10e9d0dffd98c7a290b53c180f6422920107530ff11cf
MD5 3131789c4dbccd43c851905a74d336f6
BLAKE2b-256 e20317341d561adc229033f488945d94908e6b13dc5bfe03f0497a35a1a3d651

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