Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/discordjug/javabot/Bot.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void onApplicationEvent(ApplicationReadyEvent event) {
*/
public static void main(String[] args) throws Exception {
TimeZone.setDefault(TimeZone.getTimeZone(ZoneOffset.UTC));
MessageRequest.setDefaultMentions(EnumSet.of(Message.MentionType.ROLE, Message.MentionType.CHANNEL, Message.MentionType.USER, Message.MentionType.EMOJI));
MessageRequest.setDefaultMentions(EnumSet.of(Message.MentionType.CHANNEL, Message.MentionType.USER, Message.MentionType.EMOJI));
SpringApplication.run(Bot.class, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ private void createReportThread(Message message, long targetId, ModerationConfig
message.createThreadChannel(message.getEmbeds().get(0).getTitle()).queue(
thread -> {
thread.sendMessage(config.getStaffRole().getAsMention())
.mention(config.getStaffRole())
.setComponents(setComponents(targetId, thread.getIdLong()))
.queue();
onSuccess.accept(thread);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void lockServer(Guild guild, @NotNull Collection<Member> potentialRaiders
config.getModerationConfig().getStaffRole().getAsMention(),
potentialRaiders.size(),
membersString
));
).mention(config.getModerationConfig().getStaffRole()));
} else {
notification.sendToModerationLog(c -> c.sendMessage("Server locked by " + lockedBy.getAsMention()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.discordjug.javabot.util.Responses;
import net.discordjug.javabot.util.UserUtils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.UserSnowflake;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
Expand Down Expand Up @@ -67,7 +68,7 @@ protected InteractionCallbackAction<?> handleCommand(@NotNull SlashCommandIntera
"> %s\nPriority: **%d**\nCreated by: %s\nCreated at: <t:%s:D>",
question.getText(),
question.getPriority(),
event.getJDA().retrieveUserById(question.getCreatedBy()).complete().getAsMention(),
UserSnowflake.fromId(question.getCreatedBy()).getAsMention(),
question.getCreatedAt().toEpochSecond(ZoneOffset.UTC)
),
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private void sendReviewInformation(Guild guild, QOTWConfig qotwConfig, TextChann
.sendMessageFormat("%s%nIt's review time! There are **%s** threads to review",
qotwConfig.getQOTWReviewRole().getAsMention(),
qotwConfig.getSubmissionChannel().getThreadChannels().size())
.mention(qotwConfig.getQOTWReviewRole())
.flatMap(msg -> msg.createThreadChannel("QOTW review"))
.queue(thread -> {
for (ThreadChannel submission : qotwConfig.getSubmissionChannel().getThreadChannels()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void execute() throws SQLException {
}
Optional<QOTWQuestion> nextQuestion = questionQueueRepository.getNextQuestion(guild.getIdLong());
if (nextQuestion.isEmpty()) {
notificationService.withGuild(guild).sendToModerationLog(m -> m.sendMessageFormat("Warning! %s No available next question for QOTW!", config.getQotwConfig().getQOTWReviewRole().getAsMention()));
notificationService.withGuild(guild).sendToModerationLog(m -> m.sendMessageFormat("Warning! %s No available next question for QOTW!", config.getQotwConfig().getQOTWReviewRole().getAsMention()).mention(config.getQotwConfig().getQOTWReviewRole()));
} else {
QOTWQuestion question = nextQuestion.get();
QOTWConfig qotw = config.getQotwConfig();
Expand All @@ -70,6 +70,7 @@ public void execute() throws SQLException {
NewsChannel questionChannel = qotw.getQuestionChannel();
if (questionChannel != null) {
questionChannel.sendMessage(qotw.getQOTWRole().getAsMention())
.mention(qotw.getQOTWRole())
.setEmbeds(this.buildQuestionEmbed(question))
.setComponents(ActionRow.of(Button.success("qotw-submission:submit:" + question.getQuestionNumber(), "Submit your Answer")))
.queue(msg -> questionChannel.crosspostMessageById(msg.getIdLong()).queue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void execute() throws SQLException {
if (q.isEmpty()) {
notificationService.withGuild(guild).sendToModerationLog(m -> m.sendMessageFormat(
"Warning! %s There's no Question of the Week in the queue. Please add one before it's time to post!",
config.getQOTWReviewRole().getAsMention()));
config.getQOTWReviewRole().getAsMention()).mention(config.getQOTWReviewRole()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import net.discordjug.javabot.systems.notification.NotificationService;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message;

import java.util.EnumSet;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -40,7 +37,7 @@ public void execute() {
channel
.sendMessageFormat("%s\n**Reminder**\nThe QOTW has not been reviewed yet.",
guildConfig.getQotwConfig().getQOTWReviewRole().getAsMention())
.setAllowedMentions(EnumSet.of(Message.MentionType.ROLE))
.mention(guildConfig.getQotwConfig().getQOTWReviewRole())
);
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/discordjug/javabot/util/Responses.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.awt.Color;
import java.time.Instant;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import javax.annotation.CheckReturnValue;
Expand Down Expand Up @@ -120,17 +121,17 @@ private Responses() {

@CheckReturnValue
public static @NotNull ReplyCallbackAction replyCannotInteract(IReplyCallback event, @NotNull IMentionable mentionable) {
return error(event, "I am missing permissions in order to interact with that. (%s)", mentionable.getAsMention());
return error(event, "I am missing permissions in order to interact with that. (%s)", mentionable.getAsMention()).setAllowedMentions(List.of());
}

@CheckReturnValue
public static @NotNull ReplyCallbackAction replyStaffOnly(IReplyCallback event, GuildConfig guildConfig) {
return error(event, "This command may only be used by staff members. (%s)", guildConfig.getModerationConfig().getStaffRole().getAsMention());
return error(event, "This command may only be used by staff members. (%s)", guildConfig.getModerationConfig().getStaffRole().getAsMention()).setAllowedMentions(List.of());
}

@CheckReturnValue
public static @NotNull ReplyCallbackAction replyAdminOnly(IReplyCallback event, GuildConfig guildConfig) {
return error(event, "This command may only be used by admins. (%s)", guildConfig.getModerationConfig().getAdminRole().getAsMention());
return error(event, "This command may only be used by admins. (%s)", guildConfig.getModerationConfig().getAdminRole().getAsMention()).setAllowedMentions(List.of());
}

/**
Expand Down