Put aliases inside an "aliases"-block

This commit is contained in:
MichailiK 2019-10-25 19:25:05 +02:00
parent 4fcf86a5d6
commit f17058a344
2 changed files with 55 additions and 47 deletions

View file

@ -46,8 +46,9 @@ public class BotConfig
private long owner, maxSeconds;
private OnlineStatus status;
private Game game;
private Config aliases;
private Config config;
private boolean valid = false;
public BotConfig(Prompt prompt)
@ -73,7 +74,7 @@ public class BotConfig
// load in the config file, plus the default values
//Config config = ConfigFactory.parseFile(path.toFile()).withFallback(ConfigFactory.load());
config = ConfigFactory.load();
Config config = ConfigFactory.load();
// set values
token = config.getString("token");
@ -95,6 +96,7 @@ public class BotConfig
useEval = config.getBoolean("eval");
maxSeconds = config.getLong("maxtime");
playlistsFolder = config.getString("playlistsfolder");
aliases = config.getConfig("aliases");
dbots = owner == 113156185389092864L;
// we may need to write a new config file
@ -304,9 +306,13 @@ public class BotConfig
public String[] getAliases(String command)
{
String aliases = config.getString("alias."+command);
if(aliases == null || aliases.length() <= 0)
return new String[]{};
return aliases.split(" ");
try
{
return aliases.getStringList(command).toArray(new String[0]);
}
catch(NullPointerException e)
{
return new String[0];
}
}
}

View file

@ -124,64 +124,66 @@ lyrics.default = "A-Z Lyrics"
// These settings allow you to configure custom aliases for all commands.
// Multiple aliases may be given, separated by spaces.
// Multiple aliases may be given, separated by commas.
//
// Example 1: Giving command "play" the alias "p":
// alias.play = "p"
// play = [ p ]
//
// Example 2: Giving command "search" the aliases "yts" and "find":
// alias.search = "yts find"
// search = [ yts, find ]
// General commands
aliases {
alias.settings = "status"
// General commands
settings = [ status ]
// Music commands
// Music commands
alias.lyrics = ""
alias.nowplaying = "np current"
alias.play = ""
alias.playlists = "pls"
alias.queue = "list"
alias.remove = "delete"
alias.scsearch = ""
alias.search = "ytsearch"
alias.shuffle = ""
alias.skip = "voteskip"
lyrics = []
nowplaying = [ np, current ]
play = []
playlists = [ pls ]
queue = [ list ]
remove = [ delete ]
scsearch = []
search = [ ytsearch ]
shuffle = []
skip = [ voteskip ]
// Admin commands
// Admin commands
alias.setdj = ""
alias.settc = ""
alias.setvc = ""
setdj = []
settc = []
setvc = []
// DJ Commands
// DJ Commands
alias.forceremove = "forcedelete modremove moddelete"
alias.forceskip = "modskip"
alias.movetrack = "move"
alias.pause = ""
alias.playnext = ""
alias.repeat = ""
alias.skipto = "jumpto"
alias.stop = ""
alias.volume = "vol"
forceremove = [ forcedelete, modremove, moddelete ]
forceskip = [ modskip ]
movetrack = [ move ]
pause = []
playnext = []
repeat = []
skipto = [ jumpto ]
stop = []
volume = [ vol ]
// Owner commands
alias.autoplaylist = ""
alias.debug = ""
alias.eval = ""
alias.playlist = ""
alias.setavatar = ""
alias.setgame = ""
alias.setname = ""
alias.setstatus = ""
alias.shutdown = ""
// Owner commands
autoplaylist = []
debug = []
eval = []
playlist = []
setavatar = []
setgame = []
setname = []
setstatus = []
shutdown = []
}
// If you set this to true, it will enable the eval command for the bot owner. This command
// allows the bot owner to run arbitrary code from the bot's account.