forked from Fascinated/Bat
add name history tracking
This commit is contained in:
@ -7,10 +7,12 @@ import lombok.NonNull;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
|
||||
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
|
||||
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.user.update.UserUpdateGlobalNameEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -131,4 +133,29 @@ public class EventService extends ListenerAdapter {
|
||||
listener.onModalInteraction(guild, user, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserUpdateGlobalName(@NotNull UserUpdateGlobalNameEvent event) {
|
||||
if (event.getUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
BatUser user = userService.getUser(event.getUser().getId());
|
||||
|
||||
for (EventListener listener : LISTENERS) {
|
||||
listener.onUserUpdateGlobalName(user, event.getOldGlobalName(), event.getNewGlobalName(), event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuildMemberUpdateNickname(@NotNull GuildMemberUpdateNicknameEvent event) {
|
||||
if (event.getUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
BatGuild guild = guildService.getGuild(event.getGuild().getId());
|
||||
BatUser user = userService.getUser(event.getUser().getId());
|
||||
|
||||
for (EventListener listener : LISTENERS) {
|
||||
listener.onGuildMemberUpdateNickname(guild, user, event.getOldNickname(), event.getNewNickname(), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user