mirror of
https://git.wownero.com/lza_menace/tg-bot.git
synced 2024-08-15 00:23:12 +00:00
catch exceptions where user hasnt started
This commit is contained in:
parent
b8b21092b9
commit
2d0dfc31fe
9 changed files with 90 additions and 66 deletions
|
@ -3,6 +3,7 @@ from io import BytesIO
|
|||
from PIL import Image
|
||||
from base64 import b64encode
|
||||
from qrcode import make as qrcode_make
|
||||
from telegram.error import Unauthorized
|
||||
|
||||
from tipbot import config
|
||||
|
||||
|
@ -17,3 +18,17 @@ def generate_qr(s):
|
|||
qrcode_make(s).save(_address_qr, format="PNG")
|
||||
_address_qr.seek(0)
|
||||
return _address_qr
|
||||
|
||||
def reply_user(msg, context, text, pm=True, delete=True):
|
||||
try:
|
||||
if pm:
|
||||
msg.from_user.send_message(text)
|
||||
else:
|
||||
msg.reply_text(text)
|
||||
except Unauthorized:
|
||||
msg.reply_text(f'@{msg.from_user.username}: You have to initiate a convo with the bot first: https://t.me/{context.bot.username}')
|
||||
except:
|
||||
msg.reply_text(f'@{msg.from_user.username}: Something borked -_-')
|
||||
|
||||
if delete:
|
||||
msg.delete()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue