From de002b27de4d89499dee9ec99f67974846f8d514 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Fri, 7 Aug 2020 08:01:13 -0700 Subject: [PATCH] add qr command to send helper url --- tipbot/commands/__init__.py | 6 ++++++ tipbot/commands/qr.py | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tipbot/commands/qr.py diff --git a/tipbot/commands/__init__.py b/tipbot/commands/__init__.py index 4842fea..4344eb2 100644 --- a/tipbot/commands/__init__.py +++ b/tipbot/commands/__init__.py @@ -5,6 +5,7 @@ from tipbot.commands.tip import tip from tipbot.commands.withdraw import withdraw from tipbot.commands.balance import balance from tipbot.commands.deposit import deposit +from tipbot.commands.qr import qr all_commands = { @@ -38,6 +39,11 @@ all_commands = { 'example': '/help', 'help': 'Show available commands for the bot', }, + 'qr': { + 'func': qr, + 'example': '/qr
', + 'help': 'Provides a helpful URL for generating QR code for a Wownero address' + }, 'debug': { 'func': debug, 'admin': True diff --git a/tipbot/commands/qr.py b/tipbot/commands/qr.py new file mode 100644 index 0000000..e5444ff --- /dev/null +++ b/tipbot/commands/qr.py @@ -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}')