When I running the Telegram bot, issues this error:
TgCrypto is missing! Pyrogram will work the same, but at a much slower speed. More info: https://docs.pyrogram.org/topics/speedups
Traceback (most recent call last):
File "C:\Users\Acer\Desktop\bott\bot test.py", line 52, in <module>
startfunc()
File "C:\Users\Acer\Desktop\bott\bot test.py", line 16, in startfunc
st = random.random() + random.randint(2, 4)
^^^^^^^^^^^^^
AttributeError: 'builtin_function_or_method' object has no attribute 'random'
Process finished with exit code 1
The plan is to make a bot that, when launched, will automatically write to another Telegram bot on my behalf during the day. His messages will be sent regularly. All the code is made for the in-game item farm, but that's not important. The important thing is that no matter what I do, I always get a single error. So I can't even check if this code is logically correct. Please help me to fix this error
here is my code:
from random import random
from time import sleep
from pyrogram import Client, filters
api_id = 211623999
api_hash = '64df55d4b35v660cb64034ea5d79d559'
app = Client("tymofii", api_id, api_hash)
def startfunc():
id = "@WorldDogs_bot"
planesamount = 5
i = 0
while i < planesamount:
st = random.random() + random.randint(2, 4)
app.send_message(id, "/start")
sleep(st)
app.send_message(id, " Ферма")
st = random.random() + random.randint(2, 4)
if st < 2.8:
st = 3.14
sleep(st)
m = app.iter_history("@WorldDogs_bot", 1)
print("Чекаем грибъ")
m[0].click(i)
st = random.random() + random.randint(2, 4)
if st < 2.8:
st = 3.14
sleep(st)
m = app.iter_history("@WorldDogs_bot", 1)
grno = " Смертоносный Мухомор \n\nПлохой уход за этим грибочком приведёт к быстрой смерти смельчака, попытавшегося съесть даже маленький кусочек.\n\n"
grno += "⏳ Поливать каждые 30 мин\n Каждая стадия роста длится 36 мин\n Умирает через 1 ч в сухом состоянии"
if (m[0] != grno):
if len(m[0].text) > 110:
m[0].click(1)
st = random.random() + random.randint(2, 3)
sleep(st)
m = app.iter_history(id, 1)
m[0].click(0)
st = random.random() + random.randint(2, 4)
if st < 2.8:
st = 3.14
sleep(st)
i = i + 1
startfunc()
app.connect()
app.disconnect()
app.send_message("me", "userbot started!!")