usernein / pyromod

A monkeypatcher add-on for Pyrogram
https://pyromod.pauxis.dev/
GNU Lesser General Public License v3.0
223 stars 70 forks source link

`ask` is blocking another command #47

Open Alnyz opened 9 months ago

Alnyz commented 9 months ago

i have 2 commands inside my plugins

register.py


async def callback_tutor1(bot: Bot, message: Message):
profile = bot.mongodb.find_user(message.from_user.id)
msg = f'{q1.description} \n' f'\n{q1.sort_desc}'
chat = message.chat
answer = await chat.ask('please type /profile')
if answer.text == '/profile':
await bot.send_message(chat.id, msg)

@Bot.on_message(filters.text & filters.command(['start', 'register']) & filters.private) async def register(bot: Bot, message: Message):

my logic here

 callback(bot, message)

> profile.py

```py
@Bot.on_message(filters.text & filters.command('profile') & filters.private)
async def profile(bot: Bot, message: Message):
    p = bot.mongodb.find_user(message.from_user.id)
    msg = f'**{p.username.title()}**''
    await bot.send_message(message.chat.id, msg)

first user will type /start and then bot will ask user to type /profile which is /profile is command from plugins, but command /profile didnt get execute after bot asking to the user, but command /profile work just fine.

i dont know why this happend, and cannot figure out to fix this

jusidama18 commented 9 months ago

first : /profile is not detected as command but answer to m.chat.ask second : /profile is the command

if want answer to work, it should do something like if answer == "/profile": await profile(client, message)

Sunda001 commented 9 months ago

@Alnyz lemme put this way