Updated to Discord4J v3, permission injection, improvements #99
2 changed files with 12 additions and 11 deletions
7
pom.xml
7
pom.xml
|
@ -171,15 +171,10 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
|
||||
<!-- <dependency>
|
||||
<dependency>
|
||||
<groupId>com.discord4j</groupId>
|
||||
<artifactId>Discord4J</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>com.github.SizableShrimp</groupId>
|
||||
<artifactId>Discord4J</artifactId>
|
||||
<version>httprequestchange-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
|
||||
<dependency>
|
||||
|
|
|
@ -7,6 +7,7 @@ import buttondevteam.discordplugin.commands.ICommand2DC;
|
|||
import buttondevteam.lib.TBMCCoreAPI;
|
||||
import buttondevteam.lib.chat.Command2;
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import lombok.val;
|
||||
import sx.blah.discord.handle.obj.IRole;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -63,12 +64,17 @@ public class RoleCommand extends ICommand2DC {
|
|||
}
|
||||
|
||||
private IRole checkAndGetRole(Command2DCSender sender, String rolename) {
|
||||
if (!grm.GameRoles.contains(rolename)) {
|
||||
sender.sendMessage("that role cannot be found.");
|
||||
list(sender);
|
||||
return null;
|
||||
String rname = rolename;
|
||||
if (!grm.GameRoles.contains(rolename)) { //If not found as-is, correct case
|
||||
val orn = grm.GameRoles.stream().filter(r -> r.equalsIgnoreCase(rolename)).findAny();
|
||||
if (!orn.isPresent()) {
|
||||
sender.sendMessage("that role cannot be found.");
|
||||
list(sender);
|
||||
return null;
|
||||
}
|
||||
rname = orn.get();
|
||||
}
|
||||
final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rolename);
|
||||
final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rname);
|
||||
if (roles.size() == 0) {
|
||||
sender.sendMessage("the specified role cannot be found on Discord! Removing from the list.");
|
||||
grm.GameRoles.remove(rolename);
|
||||
|
|
Loading…
Reference in a new issue