Я доделал свою программу, но у меня проблема, я не знаю как мне остановить цикл while, пока пользователь не нажмёт на кнопку

import telebot
import random
bot = telebot.TeleBot("(токен я убрал)")

class Games:
  def game(call):
    tmp = ["камень", "ножницы", "бумага"]
    while True:
      rnd = random.choice(tmp)
      inline = telebot.types.InlineKeyboardMarkup()
      k = telebot.types.InlineKeyboardButton("Камень", callback_data=10)
      n = telebot.types.InlineKeyboardButton("Ножницы", callback_data=11)
      b = telebot.types.InlineKeyboardButton("Бумага", callback_data=12)
      inline.row(k, n)
      inline.row(b)
      
      bot.send_message(call.message.chat.id, text = "Выбирай:", reply_markup=inline)
      if call.data == 10 and rnd == "камень":
        bot.send_message(call.message.chat.id, text="ничья")
      if call.data == 10 and rnd == "бумага":
        bot.send_message(call.message.chat.id, text="вы проиграли")
      if call.data == 11 and rnd == "камень":
        bot.send_message(call.message.chat.id, text="вы проиграли")
      if call.data == 11 and rnd == "ножницы":
        bot.send_message(call.message.chat.id, text="ничья")
      if call.data == 11 and rnd == "бумага":
        bot.send_message(call.message.chat.id, text="вы победили")
      if call.data == 12 and rnd == "камень":
        bot.send_message(call.message.chat.id, text="вы победили")
      if call.data == 12 and rnd == "ножницы":
        bot.send_message(call.message.chat.id, text="вы проиграли")
      if call.data == 12 and rnd == "бумага":
        bot.send_message(call.message.chat.id, text="ничья")

Ответы (0 шт):