impl boost logging????

This commit is contained in:
Lee
2024-07-04 04:28:42 +01:00
parent 040c644ab1
commit 595c61e789
6 changed files with 174 additions and 5 deletions

View File

@ -7,14 +7,17 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.model.DiscordMessage;
import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.entities.Invite;
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.invite.GuildInviteCreateEvent;
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;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRoleRemoveEvent;
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateBoostTimeEvent;
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent;
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateTimeOutEvent;
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent;
@ -315,4 +318,39 @@ public class EventService extends ListenerAdapter {
listener.onGuildVoiceUpdate(guild, user, event);
}
}
@Override
public void onGuildInviteCreate(@NotNull GuildInviteCreateEvent event) {
BatGuild guild = guildService.getGuild(event.getGuild().getId());
Invite invite = event.getInvite();
for (EventListener listener : LISTENERS) {
listener.onGuildInviteCreate(guild, invite, event);
}
}
@Override
public void onGuildMemberUpdateBoostTime(@NotNull GuildMemberUpdateBoostTimeEvent event) {
if (event.getUser().isBot()) {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
// Boost tier(s) added
if (event.getNewTimeBoosted() != null) {
for (EventListener listener : LISTENERS) {
listener.onGuildMemberBoostAdd(guild, user, event.getOldTimeBoosted(), event.getNewTimeBoosted(), event);
return;
}
}
// Boost tier(s) removed
if (event.getOldTimeBoosted() != null) {
for (EventListener listener : LISTENERS) {
listener.onGuildMemberBoostRemove(guild, user, event.getOldTimeBoosted(), event.getNewTimeBoosted(), event);
return;
}
}
}
}