Z
Z
Zohan1Gear2022-04-02 01:55:59
Python
Zohan1Gear, 2022-04-02 01:55:59

How to implement the idea? Correct please?

Doesn't see the random attribute. What is it like?

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()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2022-04-03
@Aveyloff

bot.random.randint(msg.chat.id), the bot has no such attribute. Random numbers you need to write into variables and compare after.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question