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 / cogs / runescape.py View on Github external
	@commands.command()
	async def xpbetween(self, ctx, start_level : int, end_level : int):
		start_xp = sum(int(level + 300 * 2 ** (level / 7)) for level in range(1, start_level))
		end_xp = (start_xp + sum(int(level + 300 * 2 ** (level / 7)) for level in range(start_level, end_level))) // 4
		start_xp //= 4
		await ctx.send(f"{end_xp - start_xp:,} xp between level {start_level} and level {end_level}")
github Harmon758 / Harmonbot / Twitch / cogs / words.py View on Github external
	@commands.command()
	async def define(self, ctx, *, word):
		url = f"http://api.wordnik.com:80/v4/word.json/{word}/definitions"
		params = {"limit": 1, "includeRelated": "false", "useCanonical": "false", "includeTags": "false", 
					"api_key": self.bot.WORDNIK_API_KEY}
		async with self.bot.aiohttp_session.get(url, params = params) as resp:
			if resp.status == 404:
				return await ctx.send("Error: Not found")
			data = await resp.json()
		if not data:
			return await ctx.send("Definition not found.")
		await ctx.send(f"{data[0]['word']}: {data[0]['text']}")
github Harmon758 / Harmonbot / Twitch / cogs / interactions.py View on Github external
	@commands.command(aliases = ("congrats", "grats", "gz"))
	async def congratulations(self, ctx, *, user = None):
		if not user:
			await ctx.send("Congratulations!!!!!")
		else:
			await ctx.send(f"Congratulations, {user.title()}!!!!!")
github Harmon758 / Harmonbot / Twitch / cogs / search.py View on Github external
	@commands.command(aliases = ("wiki",))
	async def wikipedia(self, ctx, *search):
		await ctx.send("https://wikipedia.org/wiki/" + '_'.join(search))
github Harmon758 / Harmonbot / Twitch / cogs / runescape.py View on Github external
	@commands.command(aliases = ("07rswiki", "rswiki07", "rswikios"))
	async def osrswiki(self, ctx, *search):
		await ctx.send("https://oldschool.runescape.wiki/w/" + '_'.join(search))
github Harmon758 / Harmonbot / Twitch / cogs / time.py View on Github external
	@commands.command(aliases = ("bday",))
	async def birthday(self, ctx, month : int = None, day : int = None):
		# TODO: Document
		# TODO: Add ability to reset
		# TODO: Handle leap day
		# TODO: Add custom birthday ability for any viewer
		now = datetime.datetime.utcnow()
		if ctx.author.name == ctx.channel.name and month and day:
			try:
				date = datetime.date(year = now.year, month = month, day = day)
			except ValueError as e:
				return await ctx.send(f"Error: {e}")
			await self.bot.db.execute(
				"""
				INSERT INTO twitch.birthdays (channel, month, day)
				VALUES ($1, $2, $3)
				ON CONFLICT (channel) DO
github Harmon758 / Harmonbot / Twitch / cogs / twitch.py View on Github external
	@commands.command()
	async def followers(self, ctx):
		# Waiting for Get Users endpoint to include follower count
		# https://discuss.dev.twitch.tv/t/new-twitch-api-get-total-followers-count/12489
		# https://discuss.dev.twitch.tv/t/regarding-data-in-kraken-not-present-in-new-twitch-api/13045
		# https://discuss.dev.twitch.tv/t/helix-get-user-missing-total-followers/15449
		users = await self.bot.get_users(ctx.channel.name)
		count = await self.bot.get_followers(users[0].id, count = True)
		await ctx.send(f"There are currently {count:,} people following {ctx.channel.name.capitalize()}.")
github TwitchIO / TwitchIO / examples / discord_integration.py View on Github external
    @commands.command(name='test')
    async def twitch_command(self, ctx):
        await ctx.send('Hai there!')
github Harmon758 / Harmonbot / Twitch / Harmonbot.py View on Github external
	@commands.command(aliases = ("8ball", '\N{BILLIARDS}'))
	async def eightball(self, ctx):
		await ctx.send(f"\N{BILLIARDS} {eightball()}")