Metadata-Version: 2.4
Name: happyhooks
Version: 0.1.0
Summary: Python package to interact with Discord webhooks
Project-URL: Repository, https://github.com/FernUnreal/happyhooks?tab=License-1-ov-file
Project-URL: Issues, https://github.com/FernUnreal/happyhooks/issues
Author-email: Fern <300829252+FernUnreal@users.noreply.github.com>
License: MIT
License-File: LICENSE
Keywords: discord,python,webhooks
Requires-Python: >=3.7
Requires-Dist: aiohttp>=3.14.1
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# Happyhooks
<img src='other/media/hphooks_logo.png' width=350>  

**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:
```python
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:
```python
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:
```python
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:
```python
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_