Skip to content

LightningReflex/DiscoPyHook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DiscoPyHook

Simple discord webhook library in python created in a single file. Could probably be made much more efficient but it works. (Code could honestly not be more repetitive, someone please fix it)

shields

 

📝 Example

Example code below

from DiscoPyHook import DiscoPyHook as DPH
import time

webhook = DPH("https://discord.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz1234567890")
webhook.setContent("Hello world!")

embed = DPH.Embed()

embed.setTitle("Real title")
embed.setDescription("Real description")

embed.setFooter(DPH.Footer().setText("You can even do (look above title)")).setAuthor(DPH.Author().setName("STUFF LIKE THIS"))
embed.addField(DPH.Field().setName("Field 1").setValue("Value 1").setInline(True))
# You could also replace every "set" with "get" like you could do "embed.getTitle()" or "embed.getFields()" (returns a list)

# This also works (they all have the "setRaw(object)" method):
embed.addField(DPH.Field().setRaw({"name": "Field 2", "value": "Value 2", "inline": True}))
# timestamps!
embed.setTimestamp(time.time())

# You can do
# "embed.setColorHex("00ff00")" or
# "embed.setColorRGB(0, 255, 0)" or
# "embed.setColorInt(65280)", but you could also do
# "embed.setColorInt(0x00ff00)" because python is cool
embed.setColorInt(0x00ff00)
webhook.addEmbed(embed)

webhook.send()

Example Image

 

💖 Support?

If you need support, contact me on discord: lightningreflex