A
A
Adyl Abdinazarov2022-02-24 18:17:49
Python
Adyl Abdinazarov, 2022-02-24 18:17:49

How to make the user bot send the interlocutor his name?

I need my bot user to send a message to the interlocutor with the text "Cool person found" and write his name at the end. But instead of the name of the interlocutor enters my name. Than in telebot you can replace "msg.from_user.first_name".

@app.on_message(filters.command("top", prefixes=".") & filters.me)
def top(_, msg):
    perc = 0
    
    while(perc < 100):
        try:
            text = "Поиск крутого чела ...." + str(perc) + "%"
            msg.edit(text)
 
            perc += random.randint(99, 99)
            sleep(0.15)
 
        except FloodWait as e:
            sleep(e.x)


    msg.edit("Найден крутой чел, это " + msg.from_user.first_name)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question