{"id":16651821,"url":"https://github.com/kyb3r/dhooks","last_synced_at":"2025-04-13T04:09:02.929Z","repository":{"id":46579434,"uuid":"96745022","full_name":"kyb3r/dhooks","owner":"kyb3r","description":"A simple python Discord webhook API wrapper","archived":false,"fork":false,"pushed_at":"2021-09-23T22:27:56.000Z","size":171,"stargazers_count":191,"open_issues_count":7,"forks_count":49,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-13T04:08:56.702Z","etag":null,"topics":["asynchronous","discord","discord-webhooks","embed","json","python","webhook"],"latest_commit_sha":null,"homepage":"https://discord.gg/etJNHCQ","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyb3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-10T06:50:06.000Z","updated_at":"2025-03-17T17:01:38.000Z","dependencies_parsed_at":"2022-07-20T06:32:26.602Z","dependency_job_id":null,"html_url":"https://github.com/kyb3r/dhooks","commit_stats":null,"previous_names":["4rqm/dhooks"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyb3r%2Fdhooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyb3r%2Fdhooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyb3r%2Fdhooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyb3r%2Fdhooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyb3r","download_url":"https://codeload.github.com/kyb3r/dhooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661704,"owners_count":21141450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","discord","discord-webhooks","embed","json","python","webhook"],"created_at":"2024-10-12T09:26:41.622Z","updated_at":"2025-04-13T04:09:02.904Z","avatar_url":"https://github.com/kyb3r.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003eDiscord Webhooks\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003e\u003ci\u003eInteract with discord webhooks using python.\u003c/i\u003e\u003c/strong\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\n  \u003ca href=\"https://travis-ci.com/kyb3r/dhooks\"\u003e\n    \u003cimg src=\"https://img.shields.io/travis/com/kyb3r/dhooks/master.svg?style=for-the-badge\u0026colorB=06D6A0\" alt=\"Travis\" /\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://test-dhooks-doc.readthedocs.io/en/latest/?badge=latest\"\u003e\n    \u003cimg src=\"https://img.shields.io/readthedocs/dhooks.svg?style=for-the-badge\u0026colorB=E8BE5D\" alt=\"Documentation Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://github.com/kyb3r/dhooks/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/dhooks.svg?style=for-the-badge\u0026colorB=F489A3\" alt=\"Py Versions\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://pypi.org/project/dhooks/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/dhooks.svg?style=for-the-badge\u0026colorB=61829F\" alt=\"PyPi\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://github.com/kyb3r/dhooks/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/kyb3r/dhooks.svg?style=for-the-badge\u0026colorB=7289DA\" alt=\"LICENSE\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n  This \u003cstrong\u003esimple\u003c/strong\u003e library enables you to easily interact with discord webhooks, allowing you to easily format discord messages and discord embeds, retrieve webhook information, modify and delete webhooks. Asynchronous usage is also supported.\n\u003c/div\u003e\n\n## Installation\n\nTo install the library simply use pip.\n\n```commandline\npip install dhooks\n```\n\nIf you would also like to get the latest version of dhooks from GitHub, build docs, run tests or run examples, you may want to install\ndhooks with the optional extended dependencies.\n\n```commandline\ngit clone https://github.com/kyb3r/dhooks.git\ncd dhooks\npip install .[tests,docs,examples]\n```\n\n## Quick Start\n\n### Sending Messages:\n\n```python\nfrom dhooks import Webhook\n\nhook = Webhook('url')\n\nhook.send(\"Hello there! I'm a webhook :open_mouth:\")\n```\n\n\u003cimg src='https://i.imgur.com/8wu283y.png' width=300\u003e\n\n### Discord Embeds:\n\nYou can easily format and send embeds using this library.\n\n\u003cimg src='https://i.imgur.com/8Ms4OID.png' width=400\u003e\n\nNote: `Embed` objects from `discord.py` are also compatible with this library.\n\n```python\nfrom dhooks import Webhook, Embed\n\nhook = Webhook('url')\n\nembed = Embed(\n    description='This is the **description** of the embed! :smiley:',\n    color=0x5CDBF0,\n    timestamp='now'  # sets the timestamp to current time\n    )\n\nimage1 = 'https://i.imgur.com/rdm3W9t.png'\nimage2 = 'https://i.imgur.com/f1LOr4q.png'\n\nembed.set_author(name='Author Goes Here', icon_url=image1)\nembed.add_field(name='Test Field', value='Value of the field :open_mouth:')\nembed.add_field(name='Another Field', value='1234 :smile:')\nembed.set_footer(text='Here is my footer text', icon_url=image1)\n\nembed.set_thumbnail(image1)\nembed.set_image(image2)\n\nhook.send(embed=embed)\n```\n\n### Sending Files:\n\nYou can easily send files as shown.\n\n```python\nfrom dhooks import Webhook, File\nfrom io import BytesIO\nimport requests\n\nhook = Webhook('url')\n\nfile = File('path/to/file.png', name='cat.png')  # optional name for discord\n\nhook.send('Look at this:', file=file)\n```\n\nYou can also pass a file-like object:\n\n```python\nresponse = requests.get('https://i.imgur.com/rdm3W9t.png')\nfile = File(BytesIO(response.content), name='wow.png')\n\nhook.send('Another one:', file=file)\n```\n\n### Get Webhook Info:\n\nYou can get some basic information related to the webhook through Discord's API.\n\n```python\nhook.get_info()\n```\n\nThe following attributes will be populated with data from discord:\n\n- `hook.guild_id`\n- `hook.channel_id`\n- `hook.default_name`\n- `hook.default_avatar_url`\n\n### Modify and Delete Webhooks:\n\nYou can change the default name and avatar of a webhook easily.\n\n```python\nwith open('img.png', 'rb') as f:\n    img = f.read()  # bytes\n\nhook.modify(name='Bob', avatar=img)\n\nhook.delete()  # webhook deleted permanently\n```\n\n### Asynchronous Usage:\n\nTo asynchronously make requests using `aiohttp`, simply use `Webhook.Async` to create the object. An example is as follows. Simply use the `await` keyword when calling API methods.\n\n```python\nfrom dhooks import Webhook\n\nasync def main():\n    hook = Webhook.Async('url')\n\n    await hook.send('hello')\n    await hook.modify('bob')\n    await hook.get_info()\n    await hook.delete()\n\n    await hook.close()  # close the client session\n```\n\nAlternatively you can use an `async with` block (asynchronous context manager) to automatically close the session once finished.\n\n```python\nasync def main():\n    async with Webhook.Async('url') as hook:\n        await hook.send('hello')\n```\n\n## Documentation\n\nYou can find the full API reference [here](https://dhooks.readthedocs.io).\n\n## License\n\nThis project is licensed under MIT.\n\n## Contributing\n\nFeel free to contribute to this project, a helping hand is always appreciated.\n\n[Join our discord server](https://discord.gg/etJNHCQ).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyb3r%2Fdhooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyb3r%2Fdhooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyb3r%2Fdhooks/lists"}