Mirror of https://github.com/Jxck-S/plane-notify This is the backend to ElonsJet and other bots
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
460 B

def sendDis(message, config, image_name = None):
import requests
from discord_webhook import DiscordWebhook
webhook = DiscordWebhook(url=config.get('DISCORD', 'URL'), content=message[0:1999], username=config.get('DISCORD', 'USERNAME'))
if image_name != None:
with open(image_name, "rb") as f:
webhook.add_file(file=f.read(), filename='map.png')
try:
webhook.execute()
except requests.Exceptions:
pass