async def notify_user(self, tx: Transaction, hash: str): if tx.destination == Env.donation_address(): return bot: Bot = self.bot user = bot.get_user(tx.sending_user.id) if user is None: self.logger.warn( f"User with ID {tx.sending_user.id} was not found, so I couldn't notify them of their withdraw" ) return if Env.banano(): await user.send( f"Withdraw processed: https://creeper.banano.cc/explorer/block/{hash}" ) else: await user.send( f"Withdraw processed: https://nanocrawler.cc/explorer/block/{hash}" )
async def tipauthor_cmd(self, ctx: Context): if ctx.error: await Messages.add_x_reaction(ctx.message) return msg = ctx.message user = ctx.user send_amount = ctx.send_amount # See how much they need to make this tip. available_balance = Env.raw_to_amount(await user.get_available_balance()) if send_amount > available_balance: await Messages.add_x_reaction(ctx.message) await Messages.send_error_dm( msg.author, f"Your balance isn't high enough to complete this tip. You have **{available_balance} {Env.currency_symbol()}**, but this tip would cost you **{send_amount} {Env.currency_symbol()}**" ) return # Make the transactions in the database tx_list = [] task_list = [] tx = await Transaction.create_transaction_external( sending_user=user, amount=send_amount, destination=Env.donation_address()) # Add reactions await msg.add_reaction('\U00002611') await msg.add_reaction('\U0001F618') await msg.add_reaction('\u2764') await msg.add_reaction('\U0001F499') await msg.add_reaction('\U0001F49B') # Queue the actual send await TransactionQueue.instance().put(tx) # Update stats stats: Stats = await user.get_stats(server_id=msg.guild.id) if msg.channel.id not in config.Config.instance( ).get_no_stats_channels(): await stats.update_tip_stats(send_amount)