fixed some catch blocks to include all exceptions

fixed message sending undo action
This commit is contained in:
Sheldan
2020-05-09 01:32:09 +02:00
parent 0e7add826b
commit 8db1cead57
5 changed files with 23 additions and 5 deletions

View File

@@ -110,6 +110,17 @@ public class BotServiceBean implements BotService {
return CompletableFuture.completedFuture(null);
}
@Override
public CompletableFuture<Void> deleteMessage(Long channelId, Long messageId) {
TextChannel textChannel = getInstance().getTextChannelById(channelId);
if(textChannel != null) {
return textChannel.deleteMessageById(messageId).submit();
} else {
log.warn("Could not find channel {} to delete message {} in.", channelId, messageId);
}
return CompletableFuture.completedFuture(null);
}
@Override
public Optional<Emote> getEmote(Long serverId, AEmote emote) {
if(!emote.getCustom()) {

View File

@@ -33,11 +33,11 @@ public class UndoActionServiceBean implements UndoActionService {
deleteChannel(ids.get(0), ids.get(1));
break;
case DELETE_MESSAGE:
if(ids.size() != 3) {
if(ids.size() != 2) {
log.error("Not the correct amount of ids provided for the message deletion undo action.");
break;
}
botService.deleteMessage(ids.get(0), ids.get(1), ids.get(2));
botService.deleteMessage(ids.get(0), ids.get(1));
}
});
}