impl global name and username update logging

This commit is contained in:
Lee
2024-07-02 21:03:40 +01:00
parent 982c038b07
commit ff23ea1d6c
5 changed files with 80 additions and 3 deletions

View File

@ -22,6 +22,7 @@ import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionE
import net.dv8tion.jda.api.events.message.MessageDeleteEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.events.user.update.UserUpdateGlobalNameEvent;
import net.dv8tion.jda.api.events.user.update.UserUpdateNameEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
@ -264,4 +265,16 @@ public class EventService extends ListenerAdapter {
listener.onGuildMemberTimeout(guild, user, event);
}
}
@Override
public void onUserUpdateName(@NotNull UserUpdateNameEvent event) {
if (event.getUser().isBot()) {
return;
}
BatUser user = userService.getUser(event.getUser().getId());
for (EventListener listener : LISTENERS) {
listener.onUserUpdateName(user, event.getOldName(), event.getNewName(), event);
}
}
}