Fix parsing of arguments
This commit is contained in:
1 parent
061a18b487
commit
dbf6fd549c
2 files changed
+11
-7
No files matched your search
@@ -11,8 +11,10 @@ import net.dv8tion.jda.api.entities.*;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import netneutrality.ThreadManager;
|
||||
import netneutrality.handler.LogHandler;
|
||||
import netneutrality.utils.Settings;
|
||||
import netneutrality.utils.UserFunction;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
public class CommandContext {
|
||||
@@ -48,9 +50,10 @@ public class CommandContext {
|
||||
}
|
||||
|
||||
public String[] getArgumentsAsArray() {
|
||||
String text = message.getContentRaw().trim();
|
||||
String cmd = text.split(" ", 2)[0];
|
||||
String[] args = text.replaceFirst("(" + cmd + ")(\s)?", "").split("\s");
|
||||
String msg = message.getContentDisplay().trim();
|
||||
msg = msg.substring(Settings.getInstance().get("BOT_PREFIX", "$").length()).trim();
|
||||
String cmd = msg.split(" ", 2)[0];
|
||||
String[] args = msg.replaceFirst("(" + cmd + ")(\s)?", "").split("\s");
|
||||
|
||||
if (args.length == 1 && args[0].isEmpty())
|
||||
args = new String[0];
|
||||
@@ -59,10 +62,11 @@ public class CommandContext {
|
||||
}
|
||||
|
||||
public String getMessageText() {
|
||||
String text = message.getContentRaw().trim();
|
||||
String cmd = text.split(" ", 2)[0];
|
||||
String msg = message.getContentDisplay().trim();
|
||||
msg = msg.substring(Settings.getInstance().get("BOT_PREFIX", "$").length()).trim();
|
||||
String cmd = msg.split(" ", 2)[0];
|
||||
|
||||
return text.replaceFirst("(" + cmd + ")(\s)?", "");
|
||||
return msg.replaceFirst("(" + cmd + ")(\s)?", "");
|
||||
}
|
||||
|
||||
public Message getMessage() {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MusicManager {
|
||||
this.scheduler = new TrackScheduler(player);
|
||||
guild.getAudioManager().setSendingHandler(new AudioPlayerSendHandler(player));
|
||||
player.addListener(scheduler);
|
||||
player.setVolume(30);
|
||||
player.setVolume(15);
|
||||
|
||||
AudioSourceManagers.registerRemoteSources(playerManager);
|
||||
AudioSourceManagers.registerLocalSource(playerManager);
|
||||
|
||||
Reference in new issue
Block a user