Skip to content

Instantly share code, notes, and snippets.

@Wiper-R
Last active July 10, 2020 08:32
Show Gist options
  • Save Wiper-R/3415fea80b1d8b833cb074d708438c13 to your computer and use it in GitHub Desktop.
Save Wiper-R/3415fea80b1d8b833cb074d708438c13 to your computer and use it in GitHub Desktop.
from discord.ext import commands, flags
import discord
bot = commands.Bot(command_prefix = '.')
class Flags(commands.Cog):
def __init__(self, bot):
self.bot = bot
@flags.add_flag('--name', type=str)
@flags.add_flag('--times', type=int)
@flags.command()
async def hello(self, ctx, **flags):
for _ in range(flags['times']):
await ctx.send(f'Hello {flags["name"]}')
@commands.Cog.listener()
async def on_ready(self):
print("Bot is ready!")
bot.add_cog(Flags(bot))
bot.run("TOKEN")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment