"If" condition with numbers doesnt working

51 Views Asked by At

Even when the number is getting right, and I'm guessing it, it still writes that I have not guessed the number and I typed it wrong.

import discord
from discord.ext import commands
import random

class Fun(commands.Cog):
   def __init__(self, bot):
      self.bot = bot

   @commands.command(name='gn')
   async def gn(self, ctx, num):
      rnum = random.randint(1, 5)
      print(rnum)
      if num == rnum:
         await ctx.send('Поздравляю, ты угадал загаданое число! В будущем за это будут добавлены награды.')
      elif num != rnum:
         await ctx.send('К сожелению ты не угадал загаданое число, но ты можешь попробовать еще!')

async def setup(bot):
   await bot.add_cog(Fun(bot))

(I'm sorry for Russian text)

I'm doing it via cogs.

I tried to remove or add brackets, but it doesn't work.

0

There are 0 best solutions below