V
V
VoKaPTV2021-02-24 23:39:23
Python
VoKaPTV, 2021-02-24 23:39:23

I tried to make a panel system for admins, but something fails and the code, skipping the condition, continues to go as it went on, how to fix it?

@bot.command()
async def hack(ctx, *, text):
  author = str(ctx.message.author.mention)
  author_id = str(ctx.message.author.id)
  if author_id == admin["admin1"] or admin["admin2"]:
    await ctx.send(f'{author} : Значение {text} будет взято за ваше новое количество баллов.')
    await ctx.send("Обработка")
    print(author)
    try:
      text = int(text)
      value = db[author] = int(text)
      await ctx.send(f'Баланс игрока: {author}  составляет: {value} Баллов')
    except:
      await ctx.send("______________________________")
      await ctx.send(f"{author}: Перепроверьте введённые данные")
  else:
    print(author_id)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-02-24
@VoKaPTV

Must be

if author_id == admin["admin1"] or author_id ==  admin["admin2"]:

Because if you leave only
if author_id == admin["admin1"] or admin["admin2"]:
, then the second part will always be True, because the second part will just contain the string

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question