mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-13 19:41:38 +00:00
[AB-53] adding economy related commands
adding runtime exception to root command handling adding simple custom command module disabling slash command for show emote the utility is not given (the bot cannot show any emotes from servers its not in) fixing post target setup not allowing threads fixing post targets not supporting threads fixing interactions not considering the actual amount of embeds fixing some cases for events which are not in a guild
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.abstracto.core.command;
|
||||
|
||||
import dev.sheldan.abstracto.core.Prioritized;
|
||||
import dev.sheldan.abstracto.core.command.execution.UnParsedCommandParameter;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
public interface CommandAlternative extends Prioritized {
|
||||
boolean matches(UnParsedCommandParameter parameter);
|
||||
void execute(UnParsedCommandParameter parameter, Message message);
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class UnParsedCommandParameter {
|
||||
}
|
||||
while (m.find()) {
|
||||
if(!skippedCommand) {
|
||||
this.commandName = m.group();
|
||||
skippedCommand = true;
|
||||
continue;
|
||||
}
|
||||
@@ -49,4 +50,5 @@ public class UnParsedCommandParameter {
|
||||
.build()));
|
||||
}
|
||||
private List<UnparsedCommandParameterPiece> parameters;
|
||||
private String commandName;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CommandRegistry {
|
||||
Command findCommandByParameters(String name, UnParsedCommandParameter context, Long serverId);
|
||||
Optional<Command> findCommandByParameters(String name, UnParsedCommandParameter context, Long serverId);
|
||||
Command findCommandViaName(String message);
|
||||
List<Command> getAllCommands();
|
||||
List<Command> getAllCommandsFromModule(ModuleDefinition module);
|
||||
|
||||
@@ -13,6 +13,10 @@ public class MessageReceivedModel implements FeatureAwareListenerModel {
|
||||
private Message message;
|
||||
@Override
|
||||
public Long getServerId() {
|
||||
return message.getGuild().getIdLong();
|
||||
if(message.isFromGuild()) {
|
||||
return message.getGuild().getIdLong();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,13 @@ public class MemberDisplay {
|
||||
.userId(aUserInAServer.getUserReference().getId())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MemberDisplay fromIds(Long serverId, Long userId) {
|
||||
return MemberDisplay
|
||||
.builder()
|
||||
.memberMention(MemberUtils.getUserAsMention(userId))
|
||||
.serverId(serverId)
|
||||
.userId(userId)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user