Repository navigation
Adding the /modmail command - #493
Conversation
|
I have within the code added some code between comments and I was wondering would it be overengineering if I turned those to methods for readability and cleanness |
|
Thanks ❤️ In #311, we decided to send modmail messages to a different channel, and not #mod_audit_log. Something like 'modmail' is fine by me. You will have to make small adjustments to Also, like always, don't forget to make our pipeline checks pass! |
|
Since I haven't followed conversation on discord closely, I have a few questions about UI/UX:
Also, maybe I'm nitpicking, but since we are discussing UI (i.e. how pretty it is)… "Modmail command invoked... Message from user... who used /modmail command". Has a lot of redundant information. Just one of these is enough. For example, 'Modmail from user#123'. What do you think? |
I have been told that it has be be a file or embed otherwise people could inject pings and other things
When I tried to retrieve the user
Not really
Sounds much nicer |
|
The < @ ID> is the format to @ the user. |
|
I am not sure how to properly name this properly (since in the if statement already talks about what this code block do) or if it even needs to be turned into a method // replies to the user who called the command if the command is on cooldown
MessageChannel messageChannel = event.getChannel();
if (isChannelOnCooldown(messageChannel)) {
event
.reply("Please wait a bit, this command can only be used once per %d %s.".formatted(
COOLDOWN_DURATION_VALUE,
COOLDOWN_DURATION_UNIT.toString().toLowerCase(Locale.US)))
.setEphemeral(true)
.queue();
return;
}
channelIdToLastCommandInvocation.put(messageChannel.getIdLong(), Instant.now());and this piece of code from ChangeHelpCategoryCommand channelIdToLastCommandInvocation = Caffeine.newBuilder()
.maximumSize(1_000)
.expireAfterAccess(COOLDOWN_DURATION_VALUE, TimeUnit.of(COOLDOWN_DURATION_UNIT))
.build(); |
Yeah, that make sense. Would it be nicer UI to have message in the embed, and just have title with "Modmail from
Knew it, but had to ask. :( Thanks ^^ |
It doesn't need a new method, but it's your choice. Like you said, from the
Good name, I know exactly what it represents. And most importantly, it's consistent with our naming scheme for similar cache maps. Speaking of naming and methods, I would rather have a nicely named method here: // this message is creating the embed
String user = event.getUser().getAsMention();
boolean optionalMessage =
Objects.requireNonNull(event.getOption(OPTION_MESSAGE_PRIVATE)).getAsBoolean();
if (optionalMessage) {
user = "Anonymous";
}
MessageAction message = auditLogChannel.orElseThrow().sendMessageEmbeds(messageEmbed(user));
message = buildAttachment(attachments, message);
message.queue();
// ends hereBecause I need a few seconds of reading to understand what it does. Your comment is a good giveaway that you might want a method, because it outlines an isolated piece of code, that needs additional explanation to be easily understood. |
I think you misunderstood me, I was mentioning from which class I got it from, not the name I named it. But I will think of a name for it, when I do should I also change it in |
|
This PR also seem to handle what #219 has mentioned so It should be linked? |
I think we will leave that issue for now, since use-case for report feature would be a bit different. With report, we need additional information like the member being reported. Then message that is being replied to, so we can easily jump to the interaction, etc. Otherwise, we would have to do a lot of work to find the reported member, and comb through their history to find the offending behaviour. |
Okay thanks for the explanation |
|
Is the code good to go? Do I need to fix anything beside the merge? |
Before we can merge, you have to:
|
Zabuzard
left a comment
There was a problem hiding this comment.
Sth seems broken. it cant send DMs anymore due to:
java.lang.IllegalArgumentException: Command 'modmail' does not exist in guild 884866931784572949
gotta investigate
|
is the ui still the same? the embed? |
|
also y not use modals, now that we have modals. it'll be easier to write long modmails in a modal than a slash command option |
Tais993
left a comment
There was a problem hiding this comment.
I'm almost satisfied, just missing slashcommand mentions still.
d40ab31 to
0e46dcd
Compare
Co-authored-by: Tais993 <49957334+Tais993@users.noreply.github.com>
de7bfa5 to
8da2eca
Compare
shhh next pr |
|
@DevSerendipity what about the ui, iirc marko suggested a better ui |
That was resolved, the UI is good enough |
|
its not |
this PR is about adding |
|
Kudos, SonarCloud Quality Gate passed! |








Commands which redirects command called from Guild or Dm to a dedicated channel in Config#getModAuditLogChannelPattern()
Samples of message being public (can be seen which user called the command)


/modmail message:test from guild without message private option message-private:trueSample of message being private (can not be seen which user called the command)
/modmail message:test from guild with message private option message-private:trueThe messages related to the mode Utils
Config
Added: