mirror of
https://git.wownero.com/lza_menace/tg-bot.git
synced 2024-08-15 00:23:12 +00:00
revamp - bring the bot to life again
This commit is contained in:
parent
594407c204
commit
a6f858671e
14 changed files with 97 additions and 49 deletions
|
@ -5,7 +5,6 @@ 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 = {
|
||||
|
@ -39,11 +38,6 @@ all_commands = {
|
|||
'example': '/help',
|
||||
'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': {
|
||||
'func': debug,
|
||||
'admin': True
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from tipbot.helpers.decorators import wallet_rpc_required, log_event, check_debug
|
||||
from tipbot.helpers.utils import is_tg_admin
|
||||
from tipbot.wownero import Wallet
|
||||
|
||||
|
||||
@wallet_rpc_required
|
||||
|
@ -7,6 +8,6 @@ from tipbot.helpers.utils import is_tg_admin
|
|||
@check_debug
|
||||
def debug(update, context):
|
||||
if is_tg_admin(update.message.from_user['id']):
|
||||
pass
|
||||
update.message.reply_text('ohai')
|
||||
else:
|
||||
update.message.reply_text('you cant do that.')
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import logging
|
||||
from telegram import ParseMode
|
||||
from tipbot import wownero
|
||||
from tipbot import db
|
||||
from tipbot.helpers.decorators import wallet_rpc_required, log_event, registration_required, check_debug
|
||||
from tipbot.helpers.utils import generate_qr
|
||||
|
||||
|
||||
@wallet_rpc_required
|
||||
|
@ -12,3 +14,8 @@ def deposit(update, context):
|
|||
u = db.User.get(telegram_id=update.message.from_user['id'])
|
||||
address = wownero.Wallet().addresses(account=u.account_index)[0]
|
||||
update.message.reply_text(f'Deposit address for {u.telegram_user}: {address}')
|
||||
update.message.reply_photo(
|
||||
photo=generate_qr(address),
|
||||
caption=f'{u.telegram_user} deposit address: {address}',
|
||||
quote=False
|
||||
)
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
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}')
|
Loading…
Add table
Add a link
Reference in a new issue