Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ask is blocking another command #47

Open
Alnyz opened this issue Nov 28, 2023 · 1 comment
Open

ask is blocking another command #47

Alnyz opened this issue Nov 28, 2023 · 1 comment

Comments

@Alnyz
Copy link

Alnyz commented Nov 28, 2023

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

@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
Copy link
Contributor

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
Copy link

@Alnyz lemme put this way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants