slowmode update logging
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
14ff692b87
commit
21e7ddf549
@ -178,6 +178,9 @@ public interface EventListener {
|
|||||||
default void onChannelUpdateRegion(@NonNull BatGuild guild, @NonNull ChannelUpdateRegionEvent event) {
|
default void onChannelUpdateRegion(@NonNull BatGuild guild, @NonNull ChannelUpdateRegionEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void onChannelUpdateSlowmode(@NonNull BatGuild guild, @NonNull ChannelUpdateSlowmodeEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
default void onShutdown() {
|
default void onShutdown() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package cc.fascinated.bat.features.logging.listeners;
|
package cc.fascinated.bat.features.logging.listeners;
|
||||||
|
|
||||||
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
|
import cc.fascinated.bat.common.*;
|
||||||
import cc.fascinated.bat.common.EmbedUtils;
|
|
||||||
import cc.fascinated.bat.common.EnumUtils;
|
|
||||||
import cc.fascinated.bat.common.NumberFormatter;
|
|
||||||
import cc.fascinated.bat.event.EventListener;
|
import cc.fascinated.bat.event.EventListener;
|
||||||
import cc.fascinated.bat.features.logging.LogFeature;
|
import cc.fascinated.bat.features.logging.LogFeature;
|
||||||
import cc.fascinated.bat.features.logging.LogType;
|
import cc.fascinated.bat.features.logging.LogType;
|
||||||
@ -180,7 +177,10 @@ public class ChannelListener implements EventListener {
|
|||||||
log.info("{} \"{}\" topic was updated to {} in guild \"{}\"", type, newValue, oldValue, guild.getName());
|
log.info("{} \"{}\" topic was updated to {} in guild \"{}\"", type, newValue, oldValue, guild.getName());
|
||||||
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Topic Updated".formatted(type));
|
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Topic Updated".formatted(type));
|
||||||
description.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true);
|
description.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true);
|
||||||
description.appendLine("Topic: `%s` -> `%s`".formatted(oldValue, newValue), true);
|
description.appendLine("Topic: `%s` -> `%s`".formatted(
|
||||||
|
oldValue == null ? "No Topic" : oldValue,
|
||||||
|
newValue == null ? "No Topic" : newValue
|
||||||
|
), true);
|
||||||
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
|
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
|
||||||
.setDescription(description.build())
|
.setDescription(description.build())
|
||||||
.build());
|
.build());
|
||||||
@ -272,4 +272,21 @@ public class ChannelListener implements EventListener {
|
|||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChannelUpdateSlowmode(@NonNull BatGuild guild, @NonNull ChannelUpdateSlowmodeEvent event) {
|
||||||
|
if (Objects.equals(event.getOldValue(), event.getNewValue()) || event.getOldValue() == null || event.getNewValue() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String oldSlowmode = event.getOldValue() == 0 ? "Disabled" : TimeUtils.format(event.getOldValue() * 1000);
|
||||||
|
String newSlowmode = event.getNewValue() == 0 ? "Disabled" : TimeUtils.format(event.getNewValue() * 1000);
|
||||||
|
|
||||||
|
log.info("Text channel \"{}\" slowmode was updated to {} in guild \"{}\"", event.getChannel().getName(), newSlowmode, guild.getName());
|
||||||
|
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
|
||||||
|
.setDescription(new EmbedDescriptionBuilder("Channel Slowmode Updated")
|
||||||
|
.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true)
|
||||||
|
.appendLine("Slowmode: `%s` -> `%s`".formatted(oldSlowmode, newSlowmode), true)
|
||||||
|
.build())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,4 +507,13 @@ public class EventService extends ListenerAdapter {
|
|||||||
listener.onChannelUpdateRegion(guild, event);
|
listener.onChannelUpdateRegion(guild, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChannelUpdateSlowmode(@NotNull ChannelUpdateSlowmodeEvent event) {
|
||||||
|
BatGuild guild = guildService.getGuild(event.getGuild().getId());
|
||||||
|
|
||||||
|
for (EventListener listener : LISTENERS) {
|
||||||
|
listener.onChannelUpdateSlowmode(guild, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user