Answer the question
In order to leave comments, you need to log in
The bot gives an answer only to half of the command, and the second one simply does not work, what should I do?
Full code at the end of the message. I've been sitting for 3 hours now, I can't figure out what the problem is. The bot gives an answer to half of the question, or rather to the part before while, and after that it simply ignores my messages. Help pliz.
import discord
import random
from random import randint
from discord.ext import commands
TOKEN = "тут был токен =)"
bot = commands.Bot(command_prefix=('+'))
bot.remove_command('help')
@bot.event
async def on_ready():
print("Успешный запуск.")
@bot.command()
async def game(ctx):
banana = random.randint(1,100)
embed = discord.Embed(title="Угадай число", description="Бот загадал определённое число от 0 до 100, попытайся его отгадать", color=discord.Color.from_rgb(24,65,133))
await ctx.send(embed=embed)
while True:
chislo = int(input())
if chislo == banana:
embed = discord.Embed(title="Верно! Бот загадал это число.", description="Хэх, молодец.", color=discord.Color.from_rgb(0, 255, 127))
await ctx.send(embed=embed)
break
else:
embed = discord.Embed(title="Не верно! =( Бот загадал не это число.", description="Ну ничего! Попробуй снова.", color=discord.Color.from_rgb(220, 20, 60))
await ctx.send(embed=embed)
bot.run(TOKEN)
Answer the question
In order to leave comments, you need to log in
I recommend spending 3 hours next time learning the syntax and standard functions
When input() or raw_input() is called, program flow stops until the user enters data via the command line. To enter, you need to press Enter after completing typing. Usually Enter adds a newline character (\n), but not in this case. The entered string will simply be passed to the application.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question