Run black on all examples and require it for CI

This commit is contained in:
Rapptz
2022-03-24 23:39:50 -04:00
parent 968a1f366f
commit 8591cfc5e7
21 changed files with 91 additions and 44 deletions

View File

@@ -15,16 +15,19 @@ intents.message_content = True
bot = commands.Bot(command_prefix='?', description=description, intents=intents)
@bot.event
async def on_ready():
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
print('------')
@bot.command()
async def add(ctx, left: int, right: int):
"""Adds two numbers together."""
await ctx.send(left + right)
@bot.command()
async def roll(ctx, dice: str):
"""Rolls a dice in NdN format."""
@@ -37,22 +40,26 @@ async def roll(ctx, dice: str):
result = ', '.join(str(random.randint(1, limit)) for r in range(rolls))
await ctx.send(result)
@bot.command(description='For when you wanna settle the score some other way')
async def choose(ctx, *choices: str):
"""Chooses between multiple choices."""
await ctx.send(random.choice(choices))
@bot.command()
async def repeat(ctx, times: int, content='repeating...'):
"""Repeats a message multiple times."""
for i in range(times):
await ctx.send(content)
@bot.command()
async def joined(ctx, member: discord.Member):
"""Says when a member joined."""
await ctx.send(f'{member.name} joined in {member.joined_at}')
@bot.group()
async def cool(ctx):
"""Says if a user is cool.
@@ -62,9 +69,11 @@ async def cool(ctx):
if ctx.invoked_subcommand is None:
await ctx.send(f'No, {ctx.subcommand_passed} is not cool')
@cool.command(name='bot')
async def _bot(ctx):
"""Is the bot cool?"""
await ctx.send('Yes, the bot is cool.')
bot.run('token')