Only add /search when there's a message provider

This commit is contained in:
JeDaYoshi 2021-07-04 00:31:43 +00:00
parent 058b3155d0
commit 69c37a535b
No known key found for this signature in database
GPG Key ID: 8060B288C274219D
2 changed files with 12 additions and 6 deletions

View File

@ -1,4 +1,4 @@
const clientSideCommands = ["/collapse", "/expand", "/search"]; const clientSideCommands = ["/collapse", "/expand"];
const passThroughCommands = [ const passThroughCommands = [
"/as", "/as",
@ -43,13 +43,19 @@ const userInputs = [
const pluginCommands = new Map(); const pluginCommands = new Map();
const getCommands = () => const getCommands = (client) => {
Array.from(userInputs.keys()) const commands = Array.from(userInputs.keys())
.concat(Array.from(pluginCommands.keys())) .concat(Array.from(pluginCommands.keys()))
.map((command) => `/${command}`) .map((command) => `/${command}`)
.concat(clientSideCommands) .concat(clientSideCommands)
.concat(passThroughCommands) .concat(passThroughCommands);
.sort();
if (client.messageProvider !== undefined) {
commands.push("/search");
}
return commands.sort();
};
const addPluginCommand = (packageInfo, command, func) => { const addPluginCommand = (packageInfo, command, func) => {
func.packageInfo = packageInfo; func.packageInfo = packageInfo;

View File

@ -692,7 +692,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
), ),
token: tokenToSend, token: tokenToSend,
}); });
socket.emit("commands", inputs.getCommands()); socket.emit("commands", inputs.getCommands(client));
}; };
if (Helper.config.public) { if (Helper.config.public) {