File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed
src/main/java/com/ibdiscord Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ SENSITIVE_ROLES=
44
44
# Separated by ;
45
45
OPT_CATEGORIES =
46
46
47
- # A list of explicitly opt-blacklisted channel IDs .
47
+ # A list of explicitly opt-blacklisted channel IDs.
48
48
# Separated by ;
49
- OPT_BLACKLIST =
49
+ OPT_BLACKLIST =
50
+
51
+ # A list of category IDs in which NSA is disabled.
52
+ # Separated by ;
53
+ NSA_CATEGORIES =
54
+
Original file line number Diff line number Diff line change @@ -103,6 +103,11 @@ public final class LocalConfig {
103
103
*/
104
104
@ Getter private final List <Long > optBlacklist ;
105
105
106
+ /**
107
+ * NSA_CATEGORIES
108
+ */
109
+ @ Getter private final List <Long > nsaCategories ;
110
+
106
111
/**
107
112
* Constructor for the local configuration object.
108
113
* Sets all of the class properties to their corresponding environment
@@ -134,6 +139,7 @@ public LocalConfig() {
134
139
this .sensitiveRoles = getEnvironment ("SENSITIVE_ROLES" , lambdaMapId , new ArrayList <>());
135
140
this .optCategories = getEnvironment ("OPT_CATEGORIES" , lambdaMapId , new ArrayList <>());
136
141
this .optBlacklist = getEnvironment ("OPT_BLACKLIST" , lambdaMapId , new ArrayList <>());
142
+ this .nsaCategories = getEnvironment ("NSA_CATEGORIES" , lambdaMapId , new ArrayList <>());
137
143
}
138
144
139
145
/**
Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ public void handleFilter(Message messageObject) {
73
73
if (author .getId ().equals (guild .getSelfMember ().getId ())) {
74
74
return ;
75
75
}
76
+ GuildChannel guildChannel = guild .getGuildChannelById (messageObject .getChannel ().getIdLong ());
77
+ if (guildChannel .getParent () != null
78
+ && IBai .INSTANCE .getConfig ().getNsaCategories ().contains (guildChannel .getParent ().getIdLong ())) {
79
+ return ;
80
+ }
76
81
String message = messageObject .getContentRaw ();
77
82
String prefix = UDatabase .getPrefix (guild );
78
83
Original file line number Diff line number Diff line change 28
28
import de .arraying .gravity .Gravity ;
29
29
import de .arraying .gravity .data .property .Property ;
30
30
import net .dv8tion .jda .api .EmbedBuilder ;
31
- import net .dv8tion .jda .api .entities .ChannelType ;
32
- import net .dv8tion .jda .api .entities .Message ;
33
- import net .dv8tion .jda .api .entities .MessageEmbed ;
34
- import net .dv8tion .jda .api .entities .TextChannel ;
31
+ import net .dv8tion .jda .api .entities .*;
35
32
import net .dv8tion .jda .api .events .message .MessageReceivedEvent ;
36
33
import net .dv8tion .jda .api .hooks .ListenerAdapter ;
37
34
@@ -51,12 +48,17 @@ public final class MonitorListener extends ListenerAdapter {
51
48
*/
52
49
@ Override
53
50
public void onMessageReceived (MessageReceivedEvent event ) {
51
+ GuildChannel guildChannel = event .getGuild ().getGuildChannelById (event .getChannel ().getIdLong ());
54
52
if (event .getAuthor ().isBot ()) {
55
53
return ;
56
54
}
57
55
if (event .getChannelType () != ChannelType .TEXT ) {
58
56
return ;
59
57
}
58
+ if (guildChannel .getParent () != null
59
+ && IBai .INSTANCE .getConfig ().getNsaCategories ().contains (guildChannel .getParent ().getIdLong ())) {
60
+ return ;
61
+ }
60
62
Message message = event .getMessage ();
61
63
Gravity gravity = DataContainer .INSTANCE .getGravity ();
62
64
MonitorData monitorData = gravity .load (new MonitorData (message .getGuild ().getId ()));
You can’t perform that action at this time.
0 commit comments