Skip to content

Commit fc3b55e

Browse files
Added EVENT_FIRED log message when no listeners were registered
1 parent b0c2c74 commit fc3b55e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/com/dynxsty/dih4jda/DIH4JDALogger.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public enum Type {
9292
BUTTON_NOT_FOUND,
9393
SELECT_MENU_NOT_FOUND,
9494
MODAL_NOT_FOUND,
95-
COMMAND_EXCEPTION
95+
COMMAND_EXCEPTION,
96+
EVENT_FIRED
9697
}
9798
}

src/main/java/com/dynxsty/dih4jda/InteractionHandler.java

+3
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,9 @@ private void handleModal(ModalInteractionEvent event) {
526526
* @since v1.5
527527
*/
528528
private void fireEvent(Set<DIH4JDAListenerAdapter> listeners, String name, Object... args) {
529+
if (listeners.isEmpty()) {
530+
DIH4JDALogger.warn(String.format("%s was fired, but not handled (No listener registered) ", name), DIH4JDALogger.Type.EVENT_FIRED);
531+
}
529532
for (DIH4JDAListenerAdapter listener : listeners) {
530533
try {
531534
for (Method method : listener.getClass().getMethods()) {

0 commit comments

Comments
 (0)