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

Can't use same button multiple times #55

Closed moha-abdi closed 4 months ago

moha-abdi commented 4 months ago

Hello below is my code, whenever I try to confirm, or cancel it works for the first time, but the next time when the message is asked again to the user and he has to confirm or cancel, it show this error message below:

image

and here is the code:

        result = await self.app.ask(
            self.chat_id,
            reply_message,
            listener_type=ListenerTypes.CALLBACK_QUERY,
            reply_markup=InlineKeyboardMarkup(
                [
                    [InlineKeyboardButton("✅ Confirm", callback_data="confirm")],
                    [InlineKeyboardButton("❌ Cancel", callback_data="cancel")]
                ]
            )
        )
        self.message = result.message if result else None

        if result and result.data == "confirm":
            await self.handle_confirmation(self.app, result)
        else:
            await self.handle_cancellation(self.app, result)