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

Add edit_original_message() for MessageComponentInteraction #2493

Merged
merged 1 commit into from
Aug 6, 2023

Conversation

B-2U
Copy link
Contributor

@B-2U B-2U commented Jul 13, 2023

in the discord api Interaction Callback Type
with value7 we can update the message the components belong to as a interaction response, but currently under the MessageComponentInteraction there's only methods related to defer, reponse and follow-up

So i tried to add it myself, basically the same but specify the .kind(InteractionResponseType::UpdateMessage)
it does work but I'm not sure should it using the same CreateInteractionResponse struct,
although it's editing a message but for discord server it should be the same.

thanks for reading

@github-actions github-actions bot added the model Related to the `model` module. label Jul 13, 2023
@arqunis arqunis changed the title adding edit_original_message() method for `MessageComponentInteract… Add edit_original_message() for MessageComponentInteraction Jul 16, 2023
@arqunis arqunis added enhancement An improvement to Serenity. discord feature Related to Discord's functionality. labels Jul 16, 2023
@B-2U
Copy link
Contributor Author

B-2U commented Jul 24, 2023

I'm not sure if I need to deal with these CI errors?

Copy link
Member

@arqunis arqunis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI failures must be due to the old version of the toolchain. I built it locally, which worked fine.

@arqunis arqunis merged commit fc68288 into serenity-rs:current Aug 6, 2023
13 of 22 checks passed
@mkrasnitski
Copy link
Collaborator

Just now taking a close look at this as we're approaching release. I'm not sure I understand why this isn't covered by create_interaction_response. Couldn't you just call .kind(InteractionResponseType::UpdateMessage) within the closure that you pass in as argument?

@B-2U
Copy link
Contributor Author

B-2U commented Sep 8, 2023

Just now taking a close look at this as we're approaching release. I'm not sure I understand why this isn't covered by create_interaction_response. Couldn't you just call .kind(InteractionResponseType::UpdateMessage) within the closure that you pass in as argument?

You are right, it's much better to do so, I was new to rust at the moment so that happened...

@mkrasnitski
Copy link
Collaborator

That's ok. I submitted a PR which simplifies the implementation. However, it's likely that on the next branch the function will have to be removed, since in #2228, CreateInteractionResponse was turned into an enum with variants representing each response type. Therefore, since you can't mutate one enum variant into another, it would be impossible to take an arbitrary CreateInteractionResponse and make it of kind UpdateMessage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discord feature Related to Discord's functionality. enhancement An improvement to Serenity. model Related to the `model` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants