add thread archive event
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 58s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 58s
This commit is contained in:
parent
8946a18b0b
commit
3995bf9992
@ -10,6 +10,7 @@ import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Invite;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.channel.Channel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
@ -264,6 +265,9 @@ public interface EventListener {
|
||||
default void onGuildUpdateSplash(@NonNull BatGuild guild, String oldSplashUrl, String newSplashUrl, @NonNull GuildUpdateSplashEvent event) {
|
||||
}
|
||||
|
||||
default void onChannelUpdateArchived(@NonNull BatGuild guild, @NonNull Channel channel, boolean isArchived, @NonNull ChannelUpdateArchivedEvent event) {
|
||||
}
|
||||
|
||||
default void onShutdown() {
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public enum LogType {
|
||||
VOICE_CHANNEL_JOIN(LogCategory.CHANNEL),
|
||||
VOICE_CHANNEL_LEAVE(LogCategory.CHANNEL),
|
||||
CHANNEL_CONFIGURATION(LogCategory.CHANNEL),
|
||||
THREAD_ARCHIVE(LogCategory.CHANNEL),
|
||||
|
||||
/**
|
||||
* Guild Events
|
||||
|
@ -14,6 +14,7 @@ import lombok.extern.log4j.Log4j2;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.Region;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.channel.Channel;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
|
||||
@ -289,4 +290,14 @@ public class ChannelListener implements EventListener {
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelUpdateArchived(@NonNull BatGuild guild, @NonNull Channel channel, boolean isArchived, @NonNull ChannelUpdateArchivedEvent event) {
|
||||
log.info("Thread \"{}\" was {} in guild \"{}\"", channel.getName(), isArchived ? "archived" : "unarchived", guild.getName());
|
||||
logFeature.sendLog(guild, LogType.THREAD_ARCHIVE, EmbedUtils.successEmbed()
|
||||
.setDescription(new EmbedDescriptionBuilder("Thread %s".formatted(isArchived ? "Archived" : "Unarchived"))
|
||||
.appendLine("Channel: %s".formatted(channel.getAsMention()), true)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
@ -732,4 +732,13 @@ public class EventService extends ListenerAdapter {
|
||||
listener.onGuildUpdateSplash(guild, event.getOldSplashUrl(), event.getNewSplashUrl(), event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelUpdateArchived(@NotNull ChannelUpdateArchivedEvent event) {
|
||||
BatGuild guild = guildService.getGuild(event.getGuild().getId());
|
||||
|
||||
for (EventListener listener : LISTENERS) {
|
||||
listener.onChannelUpdateArchived(guild, event.getEntity(), event.getNewValue(), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user