SteamWar/BungeeCore
Archiviert
13
2

Fix DC Command logging, ChatRoom and double messages
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Lixfel 2024-06-28 09:42:20 +02:00
Ursprung 42dea17ff0
Commit 6a42b802e7
3 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -48,6 +48,5 @@ public class DiscordChatRoom extends DiscordChannel {
}
ChatListener.sendChat(Chatter.of(user), target.get(), format, null, event.getMessage().getContentDisplay().replace('§', '&').replace('\n', ' '));
event.getMessage().delete().queue();
}
}

Datei anzeigen

@ -18,6 +18,7 @@
package de.steamwar.velocitycore.discord.listeners;
import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.channels.DiscordChannel;
import de.steamwar.velocitycore.discord.channels.InteractionReply;
@ -35,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
public class ChannelListener extends ListenerAdapter {
@Getter
@ -71,6 +73,7 @@ public class ChannelListener extends ListenerAdapter {
if(sender.user().getDiscordId() == null)
return;
VelocityCore.getLogger().log(Level.INFO, "%s -> executed Discord command /%s %s".formatted(sender.user().getUserName(), event.getName(), event.getOption(DiscordBot.ARGUMENT_NAME).getAsString()));
SWCommand command = DiscordBot.getCommands().get(event.getName());
UserPerm permission = command.getPermission();
if(permission != null && !sender.user().perms().contains(permission))

Datei anzeigen

@ -19,14 +19,15 @@
package de.steamwar.velocitycore.discord.listeners;
import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.DiscordTicketType;
import de.steamwar.velocitycore.discord.channels.DiscordChannel;
import de.steamwar.velocitycore.discord.channels.InteractionReply;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.ChatterGroup;
import de.steamwar.messages.Message;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.DiscordTicketType;
import de.steamwar.velocitycore.discord.channels.DiscordChannel;
import de.steamwar.velocitycore.discord.channels.InteractionReply;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.Permission;
@ -150,7 +151,9 @@ public class DiscordTicketHandler extends ListenerAdapter {
ChatterGroup receivers = Chatter.serverteam();
try {
receivers = new ChatterGroup(receivers, Chatter.of(SteamwarUser.get(Long.parseLong(channel.getTopic()))));
SteamwarUser user = SteamwarUser.get(Long.parseLong(channel.getTopic()));
if(!user.perms().contains(UserPerm.TEAM))
receivers = new ChatterGroup(receivers, Chatter.of(user));
} catch(NumberFormatException e) {
//ignored
}