Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

ben-pearce/dtreq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dtreq

PyPI license

dtreq is a Discord Webhook embed wrapper specifically designed for use with the Twisted networking engine. It is based off of kyb3r's dhooks wrapper and utilizes treq for requests.

Requirements

  • treq
  • twisted

Usage

Simple message

from dtreq import Webhook

msg = Webhook(url, msg="Hello there! I'm a webhook")

def done(response):
    print(response.status)

def error(err):
    print(err)

msg.post().addCallback(done).addErrback(error)

Advanced usage

from dtreq import Webhook

url = 'WEBHOOK_URL'

embed = Webhook(url, color=123123)

embed.setAuthor(name='Author Goes Here', icon='https://i.imgur.com/rdm3W9t.png')
embed.setDesc('This is the **description** of the embed!')
embed.addField(name='Test Field',value='Value of the field')
embed.addField(name='Another Field',value='1234 😄')
embed.setThumbnail('https://i.imgur.com/rdm3W9t.png')
embed.setImage('https://i.imgur.com/f1LOr4q.png')
embed.setFooter(text='Here is my footer text',icon='https://i.imgur.com/rdm3W9t.png',ts=True)

def done(response):
    print(response.code)

def error(err):
    print(err)

embed.post().addCallback(done).addErrback(error)

Installation

dtreq is available on the Python package index:

$ pip install dtreq

alternatively, you may clone the repository and import the module:

$ git clone https://github.com/ketnipz/dtreq 
from dtreq import Webhook

Credits

  • dhooks - Discord Webhook Embeds for Python

Licence

MIT

About

Discord webhook wrapper for Twisted

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages