tg-bot/tipbot/commands/deposit.py

22 lines
677 B
Python
Raw Normal View History

2020-08-06 05:52:13 +00:00
import logging
2021-05-08 06:50:39 +00:00
from telegram import ParseMode
2020-08-06 05:52:13 +00:00
from tipbot import wownero
from tipbot import db
from tipbot.helpers.decorators import wallet_rpc_required, log_event, registration_required, check_debug
2021-05-08 06:50:39 +00:00
from tipbot.helpers.utils import generate_qr
2020-08-06 05:52:13 +00:00
@wallet_rpc_required
@registration_required
@log_event
@check_debug
2020-08-06 05:52:13 +00:00
def deposit(update, context):
u = db.User.get(telegram_id=update.message.from_user['id'])
address = wownero.Wallet().addresses(account=u.account_index)[0]
2021-05-10 04:40:42 +00:00
update.message.from_user.send_photo(
2021-05-08 06:50:39 +00:00
photo=generate_qr(address),
2021-05-08 07:24:50 +00:00
caption=f'{u.telegram_user}\'s deposit address: {address}',
2021-05-08 06:50:39 +00:00
quote=False
)
2021-05-10 04:40:42 +00:00
update.message.delete()