Fix code style issues with Black

This commit is contained in:
Lint Action
2021-09-05 21:34:20 +00:00
parent a23dae8604
commit 7513c2138f
108 changed files with 5369 additions and 4858 deletions

View File

@@ -2,18 +2,19 @@ import discord
import random
import asyncio
class MyClient(discord.Client):
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
print(f"Logged in as {self.user} (ID: {self.user.id})")
print("------")
async def on_message(self, message):
# we do not want the bot to reply to itself
if message.author.id == self.user.id:
return
if message.content.startswith('$guess'):
await message.channel.send('Guess a number between 1 and 10.')
if message.content.startswith("$guess"):
await message.channel.send("Guess a number between 1 and 10.")
def is_correct(m):
return m.author == message.author and m.content.isdigit()
@@ -21,14 +22,15 @@ class MyClient(discord.Client):
answer = random.randint(1, 10)
try:
guess = await self.wait_for('message', check=is_correct, timeout=5.0)
guess = await self.wait_for("message", check=is_correct, timeout=5.0)
except asyncio.TimeoutError:
return await message.channel.send(f'Sorry, you took too long it was {answer}.')
return await message.channel.send(f"Sorry, you took too long it was {answer}.")
if int(guess.content) == answer:
await message.channel.send('You are right!')
await message.channel.send("You are right!")
else:
await message.channel.send(f'Oops. It is actually {answer}.')
await message.channel.send(f"Oops. It is actually {answer}.")
client = MyClient(intents=discord.Intents(guilds=True, messages=True))
client.run('token')
client.run("token")