I have a problem in line 19 of my code. It says that there is a missing argument, which is 'event'. However, I don't know how to fix this. I have looked into the docs for discord.py but I can't find anything. Can anyone help me?
from discord import Client
from discord.ext import commands
from random import randint
class Guess(commands.Cog, name="Guess the number game"):
"""This is a guess the number game."""
def __init__(self, bot):
self.bot = bot
@commands.command(name="guess")
async def _guess(self, ctx):
number = randint(1, 100)
guesses = 0
while True:
await ctx.send("Guess a number (send 'exit()') to stop:")
response = await Client.wait_for("message")
if response.content == "exit()":
await ctx.send(":thumbsup: Stopped the game!")
break
else:
try:
guess = int(response.content)
except Exception:
await ctx.send(":question: That's not a valid input! Try again.")
if guess > number:
await ctx.send("Too high! Try again.")
guesses += 1
elif guess < number:
await ctx.send("Too low! Try again.")
guesses += 1
else:
await ctx.send(f":white_check_mark: That's correct! It took you {guesses} {'guess' if guesses == 1 else 'guesses'} to get it.")
def setup(bot):
bot.add_cog(Guess(bot))