def generate_hook(): global command_expression if command_expression is not None: bot.remove_command(command_expression) static_response.__doc__ = generate_docstring() command_expression = generate_expression() bot.add_command(command_expression, static_response)
def modify_commands(commands): bot.remove_command(generate_expression(storage.data["responses"])) storage.data["responses"] = {k.lower(): v for k, v in commands.items()} storage.save() static_response.__doc__ = generate_docstring() bot.add_command(generate_expression(storage.data["responses"]), static_response)
def modify_explanations(commands): bot.remove_command("explain " + generate_expression(storage.data["explanations"])) storage.data["explanations"] = {k.lower(): v for k, v in commands.items()} storage.save() explain_response.__doc__ = generate_explain_docstring() bot.add_command( "explain " + generate_expression(storage.data["explanations"]), explain_response)
def modify_explanations(commands): bot.remove_command("explain " + generate_expression(storage.data["explanations"])) storage.data["explanations"] = {k.lower(): v for k,v in commands.items()} storage.save() explain_response.__doc__ = generate_explain_docstring() bot.add_command("explain " + generate_expression(storage.data["explanations"]), explain_response)
def modify_commands(commands): bot.remove_command(generate_expression(storage.data["responses"])) storage.data["responses"] = {k.lower(): v for k,v in commands.items()} storage.save() static_response.__doc__ = generate_docstring() bot.add_command(generate_expression(storage.data["responses"]), static_response)