Skip to content

Auto edit oiriginal massage #1288

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

Open
borgox opened this issue Mar 12, 2025 · 7 comments
Open

Auto edit oiriginal massage #1288

borgox opened this issue Mar 12, 2025 · 7 comments
Labels
feature request Request for a new feature

Comments

@borgox
Copy link

borgox commented Mar 12, 2025

Summary

A parameter of InteractionBot that avoids InteractionResponded and instead edits the original message

What is the feature request for?

The core library

The Problem

It became annoying that everytime i test things i have to spend lots of time figuring out what is conflicting in my code, it is annoying.

The Ideal Solution

i would like to add a simple parameter to InteractionBot which avoids raising an InteractionResponded error and insdtead it does self._parent.edit_original_message().

This would be useful for testing how your bot's functionality works, create small bots just to do a quick task, could also use it in bigger bots i believe it would be easier to code.

And that wouldn't, harm anyone, its just a parameter that defaults to False anyways.

The Current Solution

No response

Additional Context

No response

@borgox borgox added the feature request Request for a new feature label Mar 12, 2025
@Sharp-Eyes
Copy link
Member

If I'm understanding correctly, I think you're describing exactly what Interaction.send already does (note: not Interaction.response.send_message)?

I don't really agree with the proposal itself for a handful of reasons:

  1. I don't think many people would use this;
  2. I think your usecase is already covered by Interaction.send, which checks whether to use Interaction.response.send_message or Interaction.followup.send before any errors get raised;
  3. The proposed solution wouldn't work, InteractionResponded can be raised by more response types than just sending a message (e.g. modal creation). Editing the original response would not make sense for these;
  4. I don't think silently discarding user errors is something we should get involved with.

@borgox
Copy link
Author

borgox commented Mar 12, 2025

Well your reasoning seems fair tho i still dont understand

  1. I think your usecase is already covered by Interaction.send, which checks whether to use Interaction.response.send_message or Interaction.followup.send before any errors get raised;

@Sharp-Eyes
Copy link
Member

Sharp-Eyes commented Mar 12, 2025

inter.send simply does the following:

if self.response._response_type is not None:  # Check if there is a response already
    sender = self.followup.send  # YES: use inter.followup.send
else:
    sender = self.response.send_message  # NO: use inter.response.send_message
await sender(...)

source

You can do the same for editing if you want:

if inter.response.type is not None:
    editor = inter.followup.edit
else:
    editor = inter.edit_original_response
await editor(...)

If anything, we could maybe implement an Interaction.edit method that does this (mirroring Interaction.send).

@borgox
Copy link
Author

borgox commented Mar 12, 2025

Oh i didn't know that, then how come i was still getting InteractionResponded errors on .send?

@Sharp-Eyes
Copy link
Member

Are you certain you're getting them on the .send call and not e.g. a prior .defer call?

@borgox
Copy link
Author

borgox commented Mar 12, 2025

Oh wait yeah i was getting them from defer

@DisnakeDev DisnakeDev deleted a comment Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants