@Zohan1Gear

Как реализовать задуманное? Поправьте пожалуйста?

Не видит атрибут random. Это как?
spoiler

import random
from pyrogram import Client, filters

bot = Client('Boton', '123', '123')

@bot.on_message(filters.command('game'))
def game(bot, msg):
        msg.reply_text('Ты решил сыграть со мной \"Камень, ножницы, бумага \"?! Ну давай! ')
        ver = 0
        for ver in bot.random.randint(msg.chat.id):
                while (ver == 0):
                                player = random.randint(1, 3)
                if player == 1:
                                bot.send_msg(msg.chat.id, "Ты выбрал .")
                if player == 2:
                                bot.send_msg(msg.chat.id, "Ты выбрал ✂️.")
                if player == 3:
                                bot.send_msg(msg.chat.id, "Ты выбрал .")
                                comp = random.randint(1, 3)
                if comp == 1:
                                bot.send_msg(msg.chat.id, "Комп выбрал .")
                if comp == 2:
                                bot.send_msg(msg.chat.id, "Комп выбрал ✂️.")
                if comp == 3:
                                bot.send_msg(msg.chat.id, "Комп выбрал .")
                if player == comp:
                        win = 0
                if player == 1 and comp == 2:
                        win = 1
                if player == 1 and comp == 3:
                        win = 2
                if player == 2 and comp == 1:
                        win = 2
                if player == 2 and comp == 3:
                        win = 1
                if player == 3 and comp == 1:
                        win = 1
                if player == 3 and comp == 1:
                        win = 1
                if player == 3 and comp == 2:
                        win = 2
                if win == 0:
                        bot.send_msg(msg.chat.id, "Ничья!")
                if win == 1:
                        bot.send_msg(msg.chat.id, "Ты победил!")
                if win == 2:
                        bot.send_msg(msg.chat.id, "Победил Комп!")


bot.run()

  • Вопрос задан
  • 203 просмотра
Пригласить эксперта
Ответы на вопрос 1
Aveyloff
@Aveyloff
bot.random.randint(msg.chat.id), у бота нет такого атрибута. Рандомные числа вам надо записать в переменные и сравнивать после.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы