Salz0 / telegram_flea

A open-source flea market bot, to be used in any Community
MIT License
9 stars 21 forks source link

⌨Remove Inline Button After User Interaction to Prevent Repeated Actions #20

Closed Salz0 closed 10 months ago

Salz0 commented 10 months ago

Issue Description 📝

Currently, after a user presses an inline button associated with a message in a channel, the button remains active. This allows for repeated actions, which is undesirable. Additionally, the message gets deleted from the channel upon successful action. The goal is to make the inline button disappear or be disabled once pressed, and to prevent further actions after a successful operation.

Requirements 🎯

  1. Inline Button Removal: After a user presses the inline button, it should be removed from the message.
  2. Message Deletion: Continue to delete the message from the channel after successful action, if that's the current desired behavior.
  3. Prevent Repeated Actions: Once the action is successful and the message is deleted, the action should not be allowed to be repeated.

Acceptance Criteria ✅

Possible Solution 🛠️

  1. Capture the callback query when the inline button is pressed.
  2. Delete or disable the inline button from the message.
    
    await bot.edit_message_reply_markup(
       chat_id=callback_query.message.chat.id,
       message_id=callback_query.message.message_id,
       reply_markup=None
    )
sharktankful commented 10 months ago

Hi, I'm brand new to contributing to open source (This may be my first one) but I would love to help you out with this. Do you just have to assign me this on your end?

Salz0 commented 10 months ago

Hi, I'm brand new to contributing to open source (This may be my first one) but I would love to help you out with this. Do you just have to assign me this on your end?

Hi, great to see you wanting to contribute😌 You can work on the issue right away, don't hesitate to create a pull request 🙏

sharktankful commented 10 months ago

Hi, I'm brand new to contributing to open source (This may be my first one) but I would love to help you out with this. Do you just have to assign me this on your end?

Hi, great to see you wanting to contribute😌 You can work on the issue right away, don't hesitate to create a pull request 🙏

Thanks! I'll get started on it then

sharktankful commented 10 months ago

Oh okay, Well Im at least glad the issue is solved

Salz0 commented 10 months ago

Oh okay, Well Im at least glad the issue is solved

Hey, thank you for signing up. Often people message that they will solve a particular issue but do not keep their promises. This is why we don't assign issues to particular people. Everyone is free to create a pull request.

If you worked on this, we still value your efforts and appreciate your willingness to help. That being said, I hope this does not discourage you from trying some other issue 😌