Skip to content

Commit

Permalink
fix extra space
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Jan 28, 2025
1 parent 188ad7b commit f8f6f0c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void onChannelDelete(@NotNull ChannelDeleteEvent event) {

manager.getSession(channelId).ifPresent(session -> {
var owner = event.getGuild().getMemberById(session.owner);
serverData.logger.get().ifEnabled(log -> log.onVoiceChannelDelete(session, owner, channel));
serverData.logger.get().ifEnabled(log -> log.onVoiceChannelDelete(session, channel));
session.shouldBeRemoved = true;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public Session(String owner, String channel) {
}

public void updateHistory(String line) {
this.history = history + "\n" + DurationUtils.format(Duration.between(Instant.parse(this.created), Instant.now())) + " - " + line;
this.history = history + (history.isEmpty() ? "" : "\n") + DurationUtils.format(Duration.between(Instant.parse(this.created), Instant.now())) + " - " + line;
}
}
}
9 changes: 2 additions & 7 deletions src/main/java/ru/pinkgoosik/kitsun/feature/ServerLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.dv8tion.jda.api.entities.channel.Channel;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import org.jetbrains.annotations.Nullable;
import ru.pinkgoosik.kitsun.DiscordApp;
import ru.pinkgoosik.kitsun.event.DiscordEventsListener;
import ru.pinkgoosik.kitsun.util.DurationUtils;
Expand Down Expand Up @@ -90,18 +89,14 @@ public void onVoiceChannelNameUpdate(String old, String current) {
// log(embed.build());
}

public void onVoiceChannelDelete(AutoChannelsManager.Session session, @Nullable Member owner, Channel voiceChannel) {
public void onVoiceChannelDelete(AutoChannelsManager.Session session, Channel voiceChannel) {
var embed = new EmbedBuilder();
embed.setTitle("Voice Channel Deleted");

Instant created = Instant.parse(session.created);
Instant now = Instant.now();
String ownerLine = "";
if(owner != null) {
ownerLine = " **Owner** " + "<@" + owner.getId() + ">";
}

embed.setDescription("**Channel** " + voiceChannel.getName() + ownerLine + " **Lasted** " + DurationUtils.format(Duration.between(created, now)) + "\n \n" + session.history);
embed.setDescription("**Channel** " + voiceChannel.getName() + " **Owner** " + "<@" + session.owner + ">" + " **Lasted** " + DurationUtils.format(Duration.between(created, now)) + "\n \n" + session.history);

embed.setColor(KitsunColors.getRed());
embed.setTimestamp(Instant.now());
Expand Down

0 comments on commit f8f6f0c

Please sign in to comment.