2020-07-21 06:41:57 +00:00
|
|
|
import click
|
|
|
|
import db
|
|
|
|
import wownero
|
|
|
|
import commands
|
|
|
|
|
|
|
|
|
|
|
|
@click.group()
|
|
|
|
def cli():
|
|
|
|
pass
|
|
|
|
|
2020-08-04 17:09:39 +00:00
|
|
|
@click.command()
|
|
|
|
def debug():
|
|
|
|
pass
|
|
|
|
|
2020-07-21 06:41:57 +00:00
|
|
|
@click.command()
|
2020-08-04 20:05:10 +00:00
|
|
|
def get_users():
|
2020-07-21 06:41:57 +00:00
|
|
|
users = db.User.select()
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
for u in users:
|
2020-08-04 20:05:10 +00:00
|
|
|
click.echo(f'{u.telegram_user} ({u.telegram_id}) - wallet {u.account_index}')
|
2020-07-21 06:41:57 +00:00
|
|
|
|
|
|
|
@click.command()
|
|
|
|
@click.argument('account_index')
|
|
|
|
def get_address(account_index):
|
|
|
|
address = wownero.Wallet().addresses(account=int(account_index))[0]
|
|
|
|
click.echo(address)
|
|
|
|
|
2020-07-21 06:44:31 +00:00
|
|
|
@click.command()
|
2020-08-04 20:05:10 +00:00
|
|
|
def get_balances():
|
2020-07-30 09:13:14 +00:00
|
|
|
wallet = wownero.Wallet()
|
|
|
|
accounts = wallet.accounts()
|
|
|
|
for acc in accounts:
|
|
|
|
balances = wallet.balances(account=acc)
|
2020-08-04 20:05:10 +00:00
|
|
|
click.echo(f'wallet {acc} - {float(balances[0])} locked, {float(balances[1])} unlocked')
|
2020-07-21 06:41:57 +00:00
|
|
|
|
|
|
|
@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"]}')
|
|
|
|
|
2020-08-04 17:09:39 +00:00
|
|
|
cli.add_command(debug)
|
2020-08-04 20:05:10 +00:00
|
|
|
cli.add_command(get_users)
|
2020-07-21 06:41:57 +00:00
|
|
|
cli.add_command(get_address)
|
|
|
|
cli.add_command(generate_bot_help)
|
2020-08-04 20:05:10 +00:00
|
|
|
cli.add_command(get_balances)
|
2020-07-21 06:41:57 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
cli()
|