mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-15 20:16:34 +00:00
fixed some catch blocks to include all exceptions
fixed message sending undo action
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ public class UndoActionInstance {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static UndoActionInstance getMessageDeleteAction(Long serverId, Long channelId, Long messageId) {
|
||||
public static UndoActionInstance getMessageDeleteAction(Long channelId, Long messageId) {
|
||||
return UndoActionInstance
|
||||
.builder()
|
||||
.action(UndoAction.DELETE_MESSAGE)
|
||||
.ids(Arrays.asList(serverId, channelId, messageId))
|
||||
.ids(Arrays.asList(channelId, messageId))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public interface BotService {
|
||||
Member getMemberInServer(AUserInAServer aUserInAServer);
|
||||
Member getMemberInServer(AServer server, AUser member);
|
||||
CompletableFuture<Void> deleteMessage(Long serverId, Long channelId, Long messageId);
|
||||
CompletableFuture<Void> deleteMessage(Long channelId, Long messageId);
|
||||
Optional<Emote> getEmote(Long serverId, AEmote emote);
|
||||
Optional<TextChannel> getTextChannelFromServer(Guild serverId, Long textChannelId);
|
||||
Optional<TextChannel> getTextChannelFromServer(Long serverId, Long textChannelId);
|
||||
|
||||
Reference in New Issue
Block a user