Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def add_set_response_commands(self):
"""Add commands with set responses"""
records = await self.db.fetch("SELECT name, response FROM twitch.commands WHERE channel = 'harmonbot'")
def set_response_command_wrapper(response):
async def set_response_command(ctx):
await ctx.send(response)
return set_response_command
for record in records:
self.add_command(commands.Command(name = record["name"],
func = set_response_command_wrapper(record["response"])))