diff --git a/pom.xml b/pom.xml index 859cb39..7444910 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.jonteohr.discord guardian - 1.0.3_12 + 1.0.3_13 guardian diff --git a/src/main/java/com/jonteohr/discord/guardian/App.java b/src/main/java/com/jonteohr/discord/guardian/App.java index 0581e89..f2d0019 100644 --- a/src/main/java/com/jonteohr/discord/guardian/App.java +++ b/src/main/java/com/jonteohr/discord/guardian/App.java @@ -23,6 +23,8 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.requests.GatewayIntent; +import net.dv8tion.jda.api.utils.MemberCachePolicy; +import net.dv8tion.jda.api.utils.cache.CacheFlag; public class App { public static JDA jda; @@ -34,14 +36,24 @@ public class App { public static Collection permissions = new ArrayList(); public static Collection channelPerms = new ArrayList(); + + private static Collection cacheFlags = new ArrayList(); public static void main(String[] args) throws LoginException { PropertyHandler prop = new PropertyHandler(); Collection intents = new ArrayList(); - intents.addAll(GatewayIntent.getIntents(GatewayIntent.ALL_INTENTS)); + intents.addAll(GatewayIntent.getIntents(GatewayIntent.DEFAULT)); + + // Disabled ChacheFlags + cacheFlags.add(CacheFlag.ACTIVITY); + cacheFlags.add(CacheFlag.CLIENT_STATUS); + cacheFlags.add(CacheFlag.EMOTE); + cacheFlags.add(CacheFlag.VOICE_STATE); jda = JDABuilder.create(prop.loadProperty("token"), intents) .setStatus(OnlineStatus.ONLINE) + .setMemberCachePolicy(MemberCachePolicy.OWNER) + .disableCache(cacheFlags) .build(); dbl = new DiscordBotListAPI.Builder() diff --git a/src/main/java/com/jonteohr/discord/guardian/commands/UnProtectChannel.java b/src/main/java/com/jonteohr/discord/guardian/commands/UnProtectChannel.java index 403857a..fc931c0 100644 --- a/src/main/java/com/jonteohr/discord/guardian/commands/UnProtectChannel.java +++ b/src/main/java/com/jonteohr/discord/guardian/commands/UnProtectChannel.java @@ -45,7 +45,11 @@ public void onGuildMessageReceived(GuildMessageReceivedEvent e) { // Create the channel name String name = ""; for(int i = 1; i < args.length; i++) { - name = name + args[i]; + if(i == args.length - 1) { + name = name + args[i]; + break; + } + name = name + args[i] + " "; } // No channel mentioned and not a voice channel