Skip to content
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,23 @@ public void onMessageReceived(MessageReceivedEvent event) {
Message message = event.getMessage();

createThread(message);

reactWith(config.getUpVoteEmoteName(), FALLBACK_UP_VOTE, guild, message);
reactWith(config.getDownVoteEmoteName(), FALLBACK_DOWN_VOTE, guild, message);
}

private static void createThread(Message message) {
String threadTitle = generateThreadTitle(message);
message.createThreadChannel(threadTitle).queue();
message.createThreadChannel(threadTitle).queue(null, exception -> {
Comment thread
ankitsmt211 marked this conversation as resolved.
Outdated
if (exception instanceof ErrorResponseException responseException
&& responseException.getErrorResponse() == ErrorResponse.UNKNOWN_MESSAGE) {
logger.info(
"Create Thread skipped: message was already deleted (likely by scamblocker) - ID: {}",
message.getIdLong());
return;

}
});
}

/**
Expand Down Expand Up @@ -93,13 +103,19 @@ private static void reactWith(String emojiName, Emoji fallbackEmoji, Guild guild
return message.addReaction(fallbackEmoji);
}).queue(ignored -> {
}, exception -> {
if (exception instanceof ErrorResponseException responseException
&& responseException.getErrorResponse() == ErrorResponse.REACTION_BLOCKED) {
// User blocked the bot, hence the bot can not add reactions to their messages.
// Nothing we can do here.
return;
if (exception instanceof ErrorResponseException responseException) {
if (responseException.getErrorResponse() == ErrorResponse.REACTION_BLOCKED) {
// User blocked the bot, hence the bot can not add reactions to their messages.
// Nothing we can do here.
return;
}
if (responseException.getErrorResponse() == ErrorResponse.UNKNOWN_MESSAGE) {
logger.info(
"Reaction skipped: message was already deleted (likely by scamblocker) - ID: {}",
message.getIdLong());
return;
}
Comment thread
ankitsmt211 marked this conversation as resolved.
Outdated
}

logger.error("Attempted to react to a suggestion, but failed", exception);
});
}
Expand Down
Loading