import click import db import wownero import commands @click.group() def cli(): pass @click.command() def get_registered_users(): users = db.User.select() wallet = wownero.Wallet() for u in users: click.echo(f'{u.account_index} - {u.telegram_id}') @click.command() @click.argument('account_index') def get_address(account_index): address = wownero.Wallet().addresses(account=int(account_index))[0] click.echo(address) @click.command() def get_wallet_balances(): wallet = wownero.Wallet() accounts = wallet.accounts() for acc in accounts: balances = wallet.balances(account=acc) click.echo(f'{acc} - {float(balances[0])} locked, {float(balances[1])} unlocked') @click.command() def generate_bot_help(): for cmd in commands.all_commands: c = commands.all_commands[cmd] if not 'admin' in c: click.echo(f'{cmd} - {commands.all_commands[cmd]["help"]}') cli.add_command(get_registered_users) cli.add_command(get_address) cli.add_command(generate_bot_help) cli.add_command(get_wallet_balances) if __name__ == '__main__': cli()