سوال درباره وردی گرفتن ربات از کاربر

سلام

یه سوال هم داشتم چطوری از کاربر ورودی بگیریم مثلا به کاربر پیام میدیم لطفا فلان چیز رو وارد کنید و قتی کاربر وارد میکنه از کجا بفهمیم مال اینه و این داستانا

1 answer

توسعه دهنده پایروبله

by daradege , 9 days ago

@amirhossein6985 


سلام، به این صورت:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import pyrobale

bot = pyrobale.Client("TOKEN")

@bot.on_command("start")
async def start(message: pyrobale.Message):

    await message.reply("what's your name?")

    def check(m: pyrobale.Message):
        return m.chat.id == message.chat.id and message.user.id == m.user.id and bool(m.text)

    ms = await bot.wait_for(pyrobale.UpdatesTypes.MESSAGE, check=check)
    await message.reply(f"hi {ms.text}")

bot.run()