SteamWar/BungeeCore
Archiviert
13
2

Fix DiscordCommands
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 10:41:23 +02:00
Ursprung ba75129d57
Commit 5d9d5de237

Datei anzeigen

@ -18,12 +18,12 @@
package de.steamwar.velocitycore.discord.listeners; package de.steamwar.velocitycore.discord.listeners;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.UserPerm;
import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.channels.DiscordChannel; import de.steamwar.velocitycore.discord.channels.DiscordChannel;
import de.steamwar.velocitycore.discord.channels.InteractionReply; import de.steamwar.velocitycore.discord.channels.InteractionReply;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.UserPerm;
import lombok.Getter; import lombok.Getter;
import net.dv8tion.jda.api.entities.ChannelType; import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.MessageChannel;
@ -32,10 +32,12 @@ import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent; import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.InteractionType; import net.dv8tion.jda.api.interactions.InteractionType;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.logging.Level; import java.util.logging.Level;
public class ChannelListener extends ListenerAdapter { public class ChannelListener extends ListenerAdapter {
@ -79,7 +81,7 @@ public class ChannelListener extends ListenerAdapter {
if(permission != null && !sender.user().perms().contains(permission)) if(permission != null && !sender.user().perms().contains(permission))
return; return;
command.execute(sender, event.getOption(DiscordBot.ARGUMENT_NAME).getAsString().split(" ")); command.execute(sender, Optional.ofNullable(event.getOption(DiscordBot.ARGUMENT_NAME)).map(OptionMapping::getAsString).orElse("").split(" "));
}); });
} }
} }