mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 04:23:13 +00:00
Only add /search when there's a message provider
This commit is contained in:
parent
058b3155d0
commit
69c37a535b
2 changed files with 12 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue