mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
wot
This commit is contained in:
parent
6f03b37aa5
commit
e06dc9a5e8
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,9 @@ file = open("telegramtoken.txt", "r")
|
||||||
token = file.read()
|
token = file.read()
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
class TelegramError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
# Send a message
|
# Send a message
|
||||||
async def send_message(msg: str, to: int):
|
async def send_message(msg: str, to: int):
|
||||||
print("[Telegram] Sending a message: " + msg)
|
print("[Telegram] Sending a message: " + msg)
|
||||||
|
@ -22,4 +25,4 @@ async def send_message(msg: str, to: int):
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
raise Exception("Something went wrong in the Telegram request.")
|
raise TelegramError("Something went wrong in the Telegram request: {}".format(r.json()["description"]))
|
||||||
|
|
Loading…
Reference in a new issue