add channel position update log
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 57s

This commit is contained in:
Lee 2024-07-04 17:55:10 +01:00
parent 96c4e03e81
commit 0ba532a9b5
3 changed files with 25 additions and 0 deletions

View File

@ -268,6 +268,10 @@ public interface EventListener {
default void onRoleUpdatePosition(@NonNull BatGuild guild, @NonNull Role role, int oldPosition, int newPosition, @NonNull RoleUpdatePositionEvent event) {
}
default void onChannelUpdatePosition(@NonNull BatGuild guild, @NonNull Channel channel, int oldPosition, int newPosition,
@NonNull ChannelUpdatePositionEvent event) {
}
default void onShutdown() {
}
}

View File

@ -300,4 +300,16 @@ public class ChannelListener implements EventListener {
.build())
.build());
}
@Override
public void onChannelUpdatePosition(@NonNull BatGuild guild, @NonNull Channel channel, int oldPosition, int newPosition,
@NonNull ChannelUpdatePositionEvent event) {
log.info("Channel \"{}\" position was updated from {} to {} in guild \"{}\"", channel.getName(), oldPosition, newPosition, guild.getName());
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Channel Position Updated")
.appendLine("Channel: %s".formatted(channel.getAsMention()), true)
.appendLine("Position: `%s` -> `%s`".formatted(oldPosition, newPosition), true)
.build())
.build());
}
}

View File

@ -747,4 +747,13 @@ public class EventService extends ListenerAdapter {
listener.onRoleUpdatePosition(guild, event.getRole(), event.getOldPosition(), event.getNewPosition(), event);
}
}
@Override
public void onChannelUpdatePosition(@NotNull ChannelUpdatePositionEvent event) {
BatGuild guild = guildService.getGuild(event.getGuild().getId());
for (EventListener listener : LISTENERS) {
listener.onChannelUpdatePosition(guild, event.getEntity(), event.getOldValue(), event.getOldValue(), event);
}
}
}