add seperate events for boosting

This commit is contained in:
Lee 2024-07-04 04:30:45 +01:00
parent 595c61e789
commit 490080b17a
2 changed files with 4 additions and 5 deletions

@ -30,7 +30,8 @@ public enum LogType {
MEMBER_BAN(LogCategory.MEMBER, "Member Ban"), MEMBER_BAN(LogCategory.MEMBER, "Member Ban"),
MEMBER_UNBAN(LogCategory.MEMBER, "Member Unban"), MEMBER_UNBAN(LogCategory.MEMBER, "Member Unban"),
MEMBER_TIMEOUT(LogCategory.MEMBER, "Member Timeout"), MEMBER_TIMEOUT(LogCategory.MEMBER, "Member Timeout"),
MEMBER_BOOST(LogCategory.MEMBER, "Member Boost"), MEMBER_BOOSTED(LogCategory.MEMBER, "Member Boost Add"),
MEMBER_BOOST_EXPIRE(LogCategory.MEMBER, "Member Boost Remove"),
/** /**
* Channel Events * Channel Events

@ -25,8 +25,6 @@ import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateTimeOutEv
import net.dv8tion.jda.api.events.user.update.UserUpdateAvatarEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateAvatarEvent;
import net.dv8tion.jda.api.events.user.update.UserUpdateGlobalNameEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateGlobalNameEvent;
import net.dv8tion.jda.api.events.user.update.UserUpdateNameEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateNameEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -238,7 +236,7 @@ public class MemberListener implements EventListener {
oldBoostTime = oldBoostTime == null ? OffsetDateTime.now() : oldBoostTime; oldBoostTime = oldBoostTime == null ? OffsetDateTime.now() : oldBoostTime;
long boostAmount = ChronoUnit.MONTHS.between(oldBoostTime, newBoostTime); long boostAmount = ChronoUnit.MONTHS.between(oldBoostTime, newBoostTime);
long seconds = newBoostTime.toInstant().getEpochSecond(); long seconds = newBoostTime.toInstant().getEpochSecond();
logFeature.sendLog(guild, LogType.MEMBER_BOOST, EmbedUtils.successEmbed() logFeature.sendLog(guild, LogType.MEMBER_BOOSTED, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Boosted") .setDescription(new EmbedDescriptionBuilder("Member Boosted")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Boost Months: %s".formatted(boostAmount), true) .appendLine("Boost Months: %s".formatted(boostAmount), true)
@ -255,7 +253,7 @@ public class MemberListener implements EventListener {
newBoostTime = newBoostTime == null ? OffsetDateTime.now() : newBoostTime; newBoostTime = newBoostTime == null ? OffsetDateTime.now() : newBoostTime;
long boostAmount = ChronoUnit.MONTHS.between(newBoostTime, oldBoostTime); long boostAmount = ChronoUnit.MONTHS.between(newBoostTime, oldBoostTime);
logFeature.sendLog(guild, LogType.MEMBER_BOOST, EmbedUtils.errorEmbed() logFeature.sendLog(guild, LogType.MEMBER_BOOST_EXPIRE, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Boost Expired") .setDescription(new EmbedDescriptionBuilder("Member Boost Expired")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Boosts Removed: %s".formatted(boostAmount), true) .appendLine("Boosts Removed: %s".formatted(boostAmount), true)