check if the member is still boosting and update log set messages
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 40s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 40s
This commit is contained in:
parent
0120fa24ef
commit
4148f6e05f
@ -51,7 +51,7 @@ public class SetSubCommand extends BatSubCommand {
|
||||
profile.setLogChannel(logType, targetChannel);
|
||||
}
|
||||
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Log Channel");
|
||||
description.appendLine("Successfully set the log channel for all log types to %s".formatted(targetChannel.getAsMention()), false);
|
||||
description.appendLine("Successfully set the log channel for %s log events to %s".formatted(LogType.values().length, targetChannel.getAsMention()), false);
|
||||
description.emptyLine();
|
||||
description.appendLine("*To view the current log channels, use `/logs list`*", false);
|
||||
event.replyEmbeds(EmbedUtils.successEmbed().setDescription(description.build()).build()).queue();
|
||||
@ -63,7 +63,8 @@ public class SetSubCommand extends BatSubCommand {
|
||||
if (logCategory != null) {
|
||||
List<LogType> category = LogType.getLogTypesByCategory(type);
|
||||
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Log Channel");
|
||||
description.appendLine("Successfully set the log channel for the `%s` category to %s".formatted(
|
||||
description.appendLine("Successfully set the log channel for %s %s log events to %s".formatted(
|
||||
category.size(),
|
||||
logCategory.getName(),
|
||||
targetChannel.getAsMention()
|
||||
), false);
|
||||
|
@ -49,7 +49,7 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberJoin(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull GuildMemberJoinEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot())
|
||||
log.info("User \"{}\" joined the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
|
||||
|
||||
logFeature.sendLog(guild, LogType.MEMBER_JOIN, EmbedUtils.successEmbed()
|
||||
@ -77,7 +77,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberUpdateNickname(@NonNull BatGuild guild, @NonNull BatUser user, String oldName, String newName, @NonNull GuildMemberUpdateNicknameEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" changed their nickname from \"{}\" to \"{}\" in the guild \"{}\"", user.getName(), oldName, newName, guild.getDiscordGuild().getName());
|
||||
|
||||
logFeature.sendLog(guild, LogType.MEMBER_NICKNAME_UPDATE, EmbedUtils.genericEmbed()
|
||||
@ -91,7 +93,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onUserUpdateGlobalName(@NonNull BatUser user, String oldName, String newName, @NonNull UserUpdateGlobalNameEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" changed their global name from \"{}\" to \"{}\"", user.getName(), oldName, newName);
|
||||
|
||||
for (Guild guild : DiscordService.JDA.getGuilds()) {
|
||||
@ -111,7 +115,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onUserUpdateName(@NonNull BatUser user, String oldName, String newName, @NonNull UserUpdateNameEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" changed their username from \"{}\" to \"{}\"", user.getName(), oldName, newName);
|
||||
|
||||
for (Guild guild : DiscordService.JDA.getGuilds()) {
|
||||
@ -131,7 +137,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onUserUpdateAvatar(@NonNull BatUser user, String oldAvatarUrl, String newAvatarUrl, @NonNull UserUpdateAvatarEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" changed their avatar to \"{}\"", user.getName(), newAvatarUrl);
|
||||
|
||||
for (Guild guild : DiscordService.JDA.getGuilds()) {
|
||||
@ -151,7 +159,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberRoleAdd(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull List<Role> rolesAdded, @NonNull GuildMemberRoleAddEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" was given {} roles in the guild \"{}\"", user.getName(), rolesAdded.size(), guild.getDiscordGuild().getName());
|
||||
|
||||
StringBuilder roles = new StringBuilder();
|
||||
@ -170,7 +180,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberRoleRemove(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull List<Role> rolesAdded, @NonNull GuildMemberRoleRemoveEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" had {} roles removed in the guild \"{}\"", user.getName(), rolesAdded.size(), guild.getDiscordGuild().getName());
|
||||
|
||||
StringBuilder roles = new StringBuilder();
|
||||
@ -189,7 +201,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberBan(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull GuildBanEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" was banned from the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
|
||||
|
||||
logFeature.sendLog(guild, LogType.MEMBER_BAN, EmbedUtils.errorEmbed()
|
||||
@ -201,7 +215,9 @@ public class MemberListener implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onGuildMemberUnban(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull GuildUnbanEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" was unbanned from the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
|
||||
|
||||
logFeature.sendLog(guild, LogType.MEMBER_UNBAN, EmbedUtils.successEmbed()
|
||||
@ -230,17 +246,14 @@ public class MemberListener implements EventListener {
|
||||
@Override
|
||||
public void onGuildMemberBoostAdd(@NonNull BatGuild guild, @NonNull BatUser user, OffsetDateTime oldBoostTime,
|
||||
@NonNull OffsetDateTime newBoostTime, @NonNull GuildMemberUpdateBoostTimeEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" boosted the guild \"{}\" until \"{}\"", user.getName(), guild.getDiscordGuild().getName(), newBoostTime);
|
||||
|
||||
oldBoostTime = oldBoostTime == null ? OffsetDateTime.now() : oldBoostTime;
|
||||
long boostAmount = ChronoUnit.MONTHS.between(oldBoostTime, newBoostTime);
|
||||
long seconds = newBoostTime.toInstant().getEpochSecond();
|
||||
logFeature.sendLog(guild, LogType.MEMBER_BOOSTED, EmbedUtils.successEmbed()
|
||||
.setDescription(new EmbedDescriptionBuilder("Member Boosted")
|
||||
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
|
||||
.appendLine("Boost Months: `%s`".formatted(boostAmount), true)
|
||||
.appendLine("Boost End: <t:%s>".formatted(seconds), true)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
@ -248,15 +261,17 @@ public class MemberListener implements EventListener {
|
||||
@Override
|
||||
public void onGuildMemberBoostRemove(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull OffsetDateTime oldBoostTime,
|
||||
OffsetDateTime newBoostTime, @NonNull GuildMemberUpdateBoostTimeEvent event) {
|
||||
if (user.getDiscordUser().isBot()) return;
|
||||
if (user.getDiscordUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
if (event.getMember().isBoosting()) { // A boost was removed, but the user is still boosting
|
||||
return;
|
||||
}
|
||||
log.info("User \"{}\" boost expired in the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
|
||||
|
||||
newBoostTime = newBoostTime == null ? OffsetDateTime.now() : newBoostTime;
|
||||
long boostAmount = ChronoUnit.MONTHS.between(newBoostTime, oldBoostTime);
|
||||
logFeature.sendLog(guild, LogType.MEMBER_BOOST_EXPIRE, EmbedUtils.errorEmbed()
|
||||
.setDescription(new EmbedDescriptionBuilder("Member Boost Expired")
|
||||
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
|
||||
.appendLine("Boosts Removed: `%s`".formatted(boostAmount), true)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user