add qr command to send helper url

This commit is contained in:
lza_menace 2020-08-07 08:01:13 -07:00
parent a6171e9df1
commit de002b27de
2 changed files with 19 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from tipbot.commands.tip import tip
from tipbot.commands.withdraw import withdraw from tipbot.commands.withdraw import withdraw
from tipbot.commands.balance import balance from tipbot.commands.balance import balance
from tipbot.commands.deposit import deposit from tipbot.commands.deposit import deposit
from tipbot.commands.qr import qr
all_commands = { all_commands = {
@ -38,6 +39,11 @@ all_commands = {
'example': '/help', 'example': '/help',
'help': 'Show available commands for the bot', 'help': 'Show available commands for the bot',
}, },
'qr': {
'func': qr,
'example': '/qr <address>',
'help': 'Provides a helpful URL for generating QR code for a Wownero address'
},
'debug': { 'debug': {
'func': debug, 'func': debug,
'admin': True 'admin': True

13
tipbot/commands/qr.py Normal file
View File

@ -0,0 +1,13 @@
def qr(update, context):
if len(context.args) < 1:
update.message.reply_text('Not enough arguments passed.')
return False
# validate address
if len(context.args[0]) in [97, 108]:
address = context.args[0]
else:
update.message.reply_text('This does not look like a valid Wownero address. Try again.')
return False
update.message.reply_text(f'https://wownero.club/address/{address}')