Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #6 from condolent/develop
Browse files Browse the repository at this point in the history
Fixed intent issues
  • Loading branch information
jonteohr authored Jun 12, 2020
2 parents f0e1ae1 + 7e4fbd0 commit 9ab25a6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.jonteohr.discord</groupId>
<artifactId>guardian</artifactId>
<version>1.0.3_12</version>
<version>1.0.3_13</version>

<name>guardian</name>
<!-- FIXME change it to the project's website -->
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/jonteohr/discord/guardian/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,14 +36,24 @@ public class App {

public static Collection<Permission> permissions = new ArrayList<Permission>();
public static Collection<Permission> channelPerms = new ArrayList<Permission>();

private static Collection<CacheFlag> cacheFlags = new ArrayList<CacheFlag>();

public static void main(String[] args) throws LoginException {
PropertyHandler prop = new PropertyHandler();
Collection<GatewayIntent> intents = new ArrayList<GatewayIntent>();
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ab25a6

Please sign in to comment.