Skip to content

Commit 5ee1909

Browse files
committed
exclude StateListener with instanceof check
1 parent 9401ad9 commit 5ee1909

File tree

1 file changed

+4
-2
lines changed
  • src/main/java/net/javadiscord/javabot

1 file changed

+4
-2
lines changed

src/main/java/net/javadiscord/javabot/Bot.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
@SpringBootApplication
4343
@ComponentScan(
4444
includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { SlashCommand.class, ContextCommand.class, ListenerAdapter.class, Subcommand.class }),
45-
excludeFilters = @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, classes = {PresenceUpdater.class, StateListener.class})
45+
excludeFilters = @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, classes = {PresenceUpdater.class})
4646
)
4747
@EnableScheduling
4848
@RequiredArgsConstructor
@@ -58,7 +58,9 @@ public class Bot {
5858

5959
private void addEventListeners(final List<ListenerAdapter> listeners) {
6060
for (ListenerAdapter listener : listeners) {
61-
dih4jda.getJDA().addEventListener(listener);
61+
if(!(listener instanceof StateListener)) {
62+
dih4jda.getJDA().addEventListener(listener);
63+
}
6264
}
6365
dih4jda.getJDA().addEventListener(dih4jda);
6466
}

0 commit comments

Comments
 (0)