adjusting some admin commands, removing transfer and normalizing output

master
lza_menace 4 years ago
parent f4041f1325
commit f5bd08508a

@ -9,13 +9,11 @@ def cli():
pass pass
@click.command() @click.command()
def get_users(): def get_registered_users():
users = db.User.select() users = db.User.select()
wallet = wownero.Wallet() wallet = wownero.Wallet()
for u in users: for u in users:
balances = wallet.balances(account=u.account_index) click.echo(f'{u.account_index} - {u.telegram_id}')
address = wallet.addresses(account=u.account_index)[0]
click.echo(f'{u.account_index} - {u.telegram_user} ({u.telegram_id}) - {float(balances[0])} locked, {float(balances[1])} unlocked - {address}')
@click.command() @click.command()
@click.argument('account_index') @click.argument('account_index')
@ -24,15 +22,12 @@ def get_address(account_index):
click.echo(address) click.echo(address)
@click.command() @click.command()
def get_wallet_accounts(): def get_wallet_balances():
accounts = wownero.Wallet().accounts() wallet = wownero.Wallet()
click.echo(accounts) accounts = wallet.accounts()
for acc in accounts:
@click.command() balances = wallet.balances(account=acc)
@click.argument('dest_address') click.echo(f'{acc} - {float(balances[0])} locked, {float(balances[1])} unlocked')
@click.argument('amount')
def transfer(dest_address, amount):
tx = wownero.Wallet().transfer(dest_address=dest_address, amount=amount, priority=2, account=0)
@click.command() @click.command()
def generate_bot_help(): def generate_bot_help():
@ -41,11 +36,10 @@ def generate_bot_help():
if not 'admin' in c: if not 'admin' in c:
click.echo(f'{cmd} - {commands.all_commands[cmd]["help"]}') click.echo(f'{cmd} - {commands.all_commands[cmd]["help"]}')
cli.add_command(get_users) cli.add_command(get_registered_users)
cli.add_command(get_address) cli.add_command(get_address)
cli.add_command(transfer)
cli.add_command(generate_bot_help) cli.add_command(generate_bot_help)
cli.add_command(get_wallet_accounts) cli.add_command(get_wallet_balances)
if __name__ == '__main__': if __name__ == '__main__':
cli() cli()

Loading…
Cancel
Save