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

Move the Approve button to the notification channel set in appsettings.json + minor change regarding the Waiting For Approval message #6

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jedrek0429
Copy link
Contributor

No description provided.

@jedrek0429 jedrek0429 requested a review from KubaZ2 February 12, 2024 23:14
@jedrek0429 jedrek0429 deleted the branch ProgramowanieCommunity:master February 14, 2024 16:06
@jedrek0429 jedrek0429 closed this Feb 14, 2024
@jedrek0429 jedrek0429 deleted the master branch February 14, 2024 16:06
@jedrek0429 jedrek0429 restored the master branch February 14, 2024 16:06
@jedrek0429 jedrek0429 reopened this Feb 14, 2024
@jedrek0429 jedrek0429 deleted the branch ProgramowanieCommunity:master February 14, 2024 16:09
@jedrek0429 jedrek0429 closed this Feb 14, 2024
@jedrek0429 jedrek0429 deleted the master branch February 14, 2024 16:09
@jedrek0429 jedrek0429 restored the master branch February 14, 2024 16:09
@jedrek0429 jedrek0429 reopened this Feb 14, 2024
@jedrek0429
Copy link
Contributor Author

Apologies for this mess. I forgot about this PR when I made changes to my fork. This PR is still to be reviewed and merged.

@jedrek0429 jedrek0429 requested a review from KubaZ2 February 14, 2024 17:11
Comment on lines 36 to 43
await PostsHelper.SendPostResolveMessagesAsync(channelId, Context.User.Id, helper.Id, helper2?.Id, Context.Client.Rest, configuration);

var isHelper2 = helper2 != null && helper != helper2;
var user = Context.User;
return InteractionCallback.Message(new()
{
Content = $"**{configuration.Emojis.Success} {(isHelper2 ? string.Format(configuration.Interaction.WaitingForApprovalWith2HelpersResponse, helper, helper2) : string.Format(configuration.Interaction.WaitingForApprovalResponse, helper))}**",
Components =
[
new ActionRowProperties(
[
new ActionButtonProperties($"approve:{helper.Id}:{helper != user}:{(isHelper2 ? helper2!.Id : null)}:{(isHelper2 ? helper2 != user : null)}", configuration.Interaction.ApproveButtonLabel, ButtonStyle.Success),
]),
],
AllowedMentions = AllowedMentionsProperties.None,
Content = configuration.Emojis.Success,
Flags = MessageFlags.Ephemeral
});

Copy link
Member

Choose a reason for hiding this comment

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

Isn't it better to send the message about resolve in the interaction response instead of responding with an emoji and sending a normal message?
You also added an unnecessary blank line at the end.

Copy link
Contributor Author

@jedrek0429 jedrek0429 Feb 14, 2024

Choose a reason for hiding this comment

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

One of the main points of this PR, besides moving the Approve button, was to change this exact behaviour that was adopted earlier. I wanted to get rid of the ugly text that said "Original message was deleted" (as seen on the screenshot).
image
Naturally, when it comes to using a slash command this does not take place, however, I wanted to maintain some sort of consistency and make all the Post Resolve messages regular messages instead of replies or interaction responses.

Also, thank you for your additional feedback regarding my code formatting. I will include that in my next commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As promised, formatting issue fixed with 2eee47c.

Copy link
Member

Choose a reason for hiding this comment

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

But I think slash commands look good. "Original message was deleted" happens only when using a component of an ephemeral message.

Copy link
Contributor Author

@jedrek0429 jedrek0429 Feb 14, 2024

Choose a reason for hiding this comment

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

I am aware of that, but, again, all I wanted was a bit of consistency. Moreover, changing that would require either changing the helper method or not using it, which would require more code while the change wouldn't be neither that noticeable nor that important for the user.

Copy link
Member

Choose a reason for hiding this comment

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

The whole change won't be noticeable by users at all but I think sending an interaction response with an emoji is not a good idea, it's better to just respond to the interaction with the resolve message. We have more inconsistency with the current approach either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So what are you suggesting? Abandoning the helper in this particular case, or adding an exception to the method where if it's a slash command it will use an interaction response rather than a regular message?

Copy link
Member

Choose a reason for hiding this comment

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

You can create another overload (or method because maybe the current name would be confusing) that is for slash commands. The 2 methods can also share some private helpers to make the code less repetitive.

@jedrek0429 jedrek0429 requested a review from KubaZ2 February 14, 2024 21:29
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

Successfully merging this pull request may close these issues.

2 participants