impl member ban and unban logging

This commit is contained in:
Lee
2024-07-02 19:47:51 +01:00
parent 38bde93d16
commit 8b7340715c
4 changed files with 78 additions and 0 deletions

View File

@ -8,6 +8,8 @@ import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.events.channel.ChannelCreateEvent;
import net.dv8tion.jda.api.events.channel.ChannelDeleteEvent;
import net.dv8tion.jda.api.events.guild.GuildBanEvent;
import net.dv8tion.jda.api.events.guild.GuildUnbanEvent;
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.GuildMemberRoleAddEvent;
@ -222,4 +224,30 @@ public class EventService extends ListenerAdapter {
listener.onChannelDelete(guild, event);
}
}
@Override
public void onGuildBan(@NotNull GuildBanEvent 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.onGuildMemberBan(guild, user, event);
}
}
@Override
public void onGuildUnban(@NotNull GuildUnbanEvent 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.onGuildMemberUnban(guild, user, event);
}
}
}