|
|
@ -7,6 +7,13 @@ from functools import wraps
|
|
|
|
from decimal import Decimal
|
|
|
|
from decimal import Decimal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def log_event(f):
|
|
|
|
|
|
|
|
@wraps(f)
|
|
|
|
|
|
|
|
def decorated_function(*args, **kwargs):
|
|
|
|
|
|
|
|
logging.info(f'"{f.__name__}" called by {args[0].effective_chat.username}')
|
|
|
|
|
|
|
|
return f(*args, **kwargs)
|
|
|
|
|
|
|
|
return decorated_function
|
|
|
|
|
|
|
|
|
|
|
|
def wallet_rpc_required(f):
|
|
|
|
def wallet_rpc_required(f):
|
|
|
|
@wraps(f)
|
|
|
|
@wraps(f)
|
|
|
|
def decorated_function(*args, **kwargs):
|
|
|
|
def decorated_function(*args, **kwargs):
|
|
|
@ -41,6 +48,7 @@ def help(update, context):
|
|
|
|
update.message.reply_text('Here are the available commands for this bot:\n\n' + '\n\n'.join(commands))
|
|
|
|
update.message.reply_text('Here are the available commands for this bot:\n\n' + '\n\n'.join(commands))
|
|
|
|
|
|
|
|
|
|
|
|
@wallet_rpc_required
|
|
|
|
@wallet_rpc_required
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
def register(update, context):
|
|
|
|
def register(update, context):
|
|
|
|
uid = update.effective_chat.id
|
|
|
|
uid = update.effective_chat.id
|
|
|
|
un = update.effective_chat.username
|
|
|
|
un = update.effective_chat.username
|
|
|
@ -73,6 +81,7 @@ def register(update, context):
|
|
|
|
|
|
|
|
|
|
|
|
@wallet_rpc_required
|
|
|
|
@wallet_rpc_required
|
|
|
|
@registration_required
|
|
|
|
@registration_required
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
def tip(update, context):
|
|
|
|
def tip(update, context):
|
|
|
|
if len(context.args) < 2:
|
|
|
|
if len(context.args) < 2:
|
|
|
|
update.message.reply_text('Not enough arguments passed.')
|
|
|
|
update.message.reply_text('Not enough arguments passed.')
|
|
|
@ -134,6 +143,7 @@ def tip(update, context):
|
|
|
|
|
|
|
|
|
|
|
|
@wallet_rpc_required
|
|
|
|
@wallet_rpc_required
|
|
|
|
@registration_required
|
|
|
|
@registration_required
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
def send(update, context):
|
|
|
|
def send(update, context):
|
|
|
|
if len(context.args) < 2:
|
|
|
|
if len(context.args) < 2:
|
|
|
|
update.message.reply_text('Not enough arguments passed.')
|
|
|
|
update.message.reply_text('Not enough arguments passed.')
|
|
|
@ -174,6 +184,7 @@ def send(update, context):
|
|
|
|
|
|
|
|
|
|
|
|
@wallet_rpc_required
|
|
|
|
@wallet_rpc_required
|
|
|
|
@registration_required
|
|
|
|
@registration_required
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
def balance(update, context):
|
|
|
|
def balance(update, context):
|
|
|
|
u = db.User.get(telegram_id=update.effective_chat.id)
|
|
|
|
u = db.User.get(telegram_id=update.effective_chat.id)
|
|
|
|
balances = wownero.Wallet().balances(account=u.account_index)
|
|
|
|
balances = wownero.Wallet().balances(account=u.account_index)
|
|
|
@ -181,12 +192,14 @@ def balance(update, context):
|
|
|
|
|
|
|
|
|
|
|
|
@wallet_rpc_required
|
|
|
|
@wallet_rpc_required
|
|
|
|
@registration_required
|
|
|
|
@registration_required
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
def deposit(update, context):
|
|
|
|
def deposit(update, context):
|
|
|
|
u = db.User.get(telegram_id=update.effective_chat.id)
|
|
|
|
u = db.User.get(telegram_id=update.effective_chat.id)
|
|
|
|
address = wownero.Wallet().addresses(account=u.account_index)[0]
|
|
|
|
address = wownero.Wallet().addresses(account=u.account_index)[0]
|
|
|
|
update.message.reply_text(f'Deposit address for {update.effective_chat.username}: {address}')
|
|
|
|
update.message.reply_text(f'Deposit address for {update.effective_chat.username}: {address}')
|
|
|
|
|
|
|
|
|
|
|
|
@wallet_rpc_required
|
|
|
|
@wallet_rpc_required
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
def debug(update, context):
|
|
|
|
def debug(update, context):
|
|
|
|
if is_tg_admin(update.effective_chat.id):
|
|
|
|
if is_tg_admin(update.effective_chat.id):
|
|
|
|
# tx = wownero.Wallet().transfer(
|
|
|
|
# tx = wownero.Wallet().transfer(
|
|
|
|