async def on_command_error(ctx, error): if hasattr(ctx.command, 'on_error'): return if isinstance(error, commands.CommandNotFound): return await ctx.send(f'{e.INFO}Invalid command. Type `%help` for help.') if isinstance(error, errors.NotInUDB): return await ctx.send(f'{e.ERROR}You do not have an account. (type `%new` to register or type `%help` for help)') if isinstance(error, errors.TooNew): return await ctx.send(docs.too_new_msg) if isinstance(error, errors.LimChannel): return await ctx.send(docs.change_channel) if isinstance(error, (commands.MissingRequiredArgument, commands.BadArgument)): if ctx.command.name == 'withdraw': return await ctx.send(f'{e.INFO}To withdraw from your account type: `%wdr [address to send to] [amount-GRC]`\nA service fee of {g.tx_fee} GRC is subtracted from what you send. If you wish to send GRC to someone in the server, use `%give`') if ctx.command.name == 'donate': return await ctx.send(extras.index_displayer(f'{e.GIVE}Be generous! Below are possible donation options.\nTo donate, type `%donate [selection no.] [amount-GRC]`\n', await q.get_donors())) if ctx.command.name == 'rdonate': return await ctx.send(f'{e.GIVE}To donate to a random contributor type: `%rdonate [amount-GRC]`') if ctx.command.name == 'give': return await ctx.send(f'{e.INFO}To give funds to a member in the server, type `%give [discord mention of user] [amount to give]`.\nThe person must also have an account with the bot.') if ctx.command.name == 'fgive': return await ctx.send(f'{e.ERROR}Please specify an amount to give.') if ctx.command.name == 'rain': await ctx.send(await rbot.status()) return await check_rain(ctx) if ctx.command.name == 'faq': return await ctx.send(extras.index_displayer(docs.faq_msg, index) + '\n*Thanks to LavRadis and Foxifi for making these resources.*') if ctx.command.name == 'block': return await ctx.send(await extras.show_block(await w.query('getblockcount', []))) if ctx.command.name == 'help': return await ctx.send(embed=help_docs.help_main()) if isinstance(error, commands.NoPrivateMessage): return await ctx.send(docs.pm_restrict)
async def on_command_error(ctx, error): if hasattr(ctx.command, 'on_error'): return if isinstance(error, commands.CommandNotFound): return await ctx.send( f'{e.INFO}Invalid command. Type `!help` for help.') if isinstance(error, errors.NotInUDB): return await ctx.send( f'{e.ERROR}You are not in user database. (try `!new` or type `!help` for help)' ) if isinstance(error, commands.MissingRequiredArgument): if ctx.command.name == 'withdraw': return await ctx.send( f'{e.INFO}To withdraw from your account type: `!wdr [address to send to] [amount-PINK]`\nA service fee of {p.tx_fee} PINK is subtracted from what you send. If you wish to send PINK to someone in the server, use `!give`' ) if ctx.command.name == 'donate': return await ctx.send( extras.index_displayer( f'{e.GIVE}Be generous! Below are possible donation options.\nTo donate, type `!donate [selection no.] [amount-PINK]`\n', p.donation_accts)) if ctx.command.name == 'rdonate': return await ctx.send( f'{e.GIVE}To donate to a random contributor type: `!rdonate [amount-PINK]`' ) if ctx.command.name == 'give': return await ctx.send( f'{e.INFO}To give funds to a member in the server, type `!give [discord mention of user] [amount to give]`.\nThe person must also have an account with the bot.' ) if ctx.command.name == 'fgive': return await ctx.send(f'{e.ERROR}Please specify an amount to give.' ) if ctx.command.name == 'rain': return await ctx.send(rbot.status()) await check_rain(ctx) if ctx.command.name == 'block': return await ctx.send(await extras.show_block(await w.query( 'getblockcount', []))) if ctx.command.name == 'help': return await ctx.send(help_docs.help_main()) if isinstance(error, commands.NoPrivateMessage): return await ctx.send(docs.pm_restrict)
def help_interface(query): try: return help_docs.help_dict[query] except KeyError: return help_docs.help_main()