revamp - bring the bot to life again

This commit is contained in:
lza_menace 2021-05-07 23:50:39 -07:00
parent 594407c204
commit a6f858671e
14 changed files with 97 additions and 49 deletions

View file

@ -22,8 +22,11 @@ def check_debug(f):
def log_event(f):
@wraps(f)
def decorated_function(*args, **kwargs):
_d = ''
if config.DEBUG:
_d = ' (debug mode on)'
msg = args[0].message
logging.info(f'"{f.__name__}" invoked from {msg.from_user["id"]} ({msg.from_user["first_name"]}) - Full command: "{msg.text}"')
logging.info(f'"{f.__name__}" invoked from {msg.from_user["id"]} ({msg.from_user["first_name"]}) - Full command: "{msg.text}"{_d}')
return f(*args, **kwargs)
return decorated_function

View file

@ -1,3 +1,9 @@
from io import BytesIO
from PIL import Image
from base64 import b64encode
from qrcode import make as qrcode_make
from tipbot import config
def is_tg_admin(chat_id):
@ -5,3 +11,9 @@ def is_tg_admin(chat_id):
return True
else:
return False
def generate_qr(s):
_address_qr = BytesIO()
qrcode_make(s).save(_address_qr, format="PNG")
_address_qr.seek(0)
return _address_qr