How to use the twitchio.ext.commands.Command function in twitchio

To help you get started, we’ve selected a few twitchio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Harmon758 / Harmonbot / Twitch / Harmonbot.py View on Github external
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"])))