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

View file

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