1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 11:34:18 +00:00
This commit is contained in:
Steffo 2017-02-07 22:35:19 +01:00
parent 6f03b37aa5
commit e06dc9a5e8

View file

@ -8,6 +8,9 @@ file = open("telegramtoken.txt", "r")
token = file.read()
file.close()
class TelegramError(Exception):
pass
# Send a message
async def send_message(msg: str, to: int):
print("[Telegram] Sending a message: " + msg)
@ -22,4 +25,4 @@ async def send_message(msg: str, to: int):
if r.status_code == 200:
return
else:
raise Exception("Something went wrong in the Telegram request.")
raise TelegramError("Something went wrong in the Telegram request: {}".format(r.json()["description"]))