Implement basic permission check for message commands
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package wtf.beatrice.hidekobot.objects.commands;
|
||||
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public interface MessageCommand
|
||||
{
|
||||
@@ -16,10 +19,19 @@ public interface MessageCommand
|
||||
*/
|
||||
LinkedList<String> getCommandLabels();
|
||||
|
||||
/**
|
||||
* A list of permissions required to run the command. This is preferred to checking them on your own
|
||||
* as the message listener handles it more homogeneously.
|
||||
*
|
||||
* @return the list of required permissions.
|
||||
*/
|
||||
@Nullable
|
||||
List<Permission> getPermissions();
|
||||
|
||||
/**
|
||||
* Say if this command does its own text parsing, and tell the message listener if it should automatically
|
||||
* split all arguments in separate entries of an array, or pass everything as the first entry of that array.
|
||||
*
|
||||
* <p>
|
||||
* This is better instead of getting the message contents from the event, because the message listener will
|
||||
* still strip the bot prefix and command name from the args, but leave the rest untouched.
|
||||
*
|
||||
@@ -30,7 +42,6 @@ public interface MessageCommand
|
||||
/**
|
||||
* Run the command logic by parsing the event and replying accordingly.
|
||||
*
|
||||
*
|
||||
* @param event the received message event. It should not be used for parsing message contents data as
|
||||
* the arguments already account for it in a better way.
|
||||
*
|
||||
|
Reference in New Issue
Block a user