Don't explicitly trigger the hook parseMessageForCommands
inside `parseMessageForMUCCommands`. If the function doesn't find any core MUC commands, it calls `parseMessageForCommands` which will trigger the hook. I think it's appropriate to give built-in commands preference above commands by 3rd party plugins and this also solves the issue of the hook being triggered twice (once in `parseMessageForMUCCommands` and then again in `parseMessageForCommands`).
This commit is contained in:
parent
d06761e2a8
commit
003a90c71c
@ -298,7 +298,7 @@ export function showOccupantModal (ev, occupant) {
|
||||
}
|
||||
|
||||
|
||||
export async function parseMessageForMUCCommands (muc, text) {
|
||||
export function parseMessageForMUCCommands (muc, text) {
|
||||
if (
|
||||
api.settings.get('muc_disable_slash_commands') &&
|
||||
!Array.isArray(api.settings.get('muc_disable_slash_commands'))
|
||||
@ -311,11 +311,6 @@ export async function parseMessageForMUCCommands (muc, text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const handled = await api.hook('parseMessageForCommands', {model: muc, text}, false);
|
||||
if (handled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const args = text.slice(('/' + command).length + 1).trim();
|
||||
if (!muc.getAllowedCommands().includes(command)) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user