PDA

View Full Version : Comm.registerSlashHandler disabling chat whisper



mattekure
May 22nd, 2022, 00:33
In one of my extensions, I register a slash handler using the following command.


Comm.registerSlashHandler("whospeaks", handleWhoSpeaks)

Whenever this is registered, the /w and /whisper slash commands no longer work.

After doing some testing, it appears that registering any slash command that begins with a "w" will cause whisper to stop working. It just fails silently.
I have tried registering "wh", "wt", "wZ" and all cause whisper to fail.

Stv
May 22nd, 2022, 10:37
Iirc, that is the operation for any slash command that can be shortened i.e.
/w and /whisper do the same thing,
/r and /reply do the same thing

But if you register another slash command that begins with a 'W' or an 'R' then the single letter slash command will stop working.

Cheers, Steve.

mattekure
May 22nd, 2022, 13:35
Iirc, that is the operation for any slash command that can be shortened i.e.
/w and /whisper do the same thing,
/r and /reply do the same thing

But if you register another slash command that begins with a 'W' or an 'R' then the single letter slash command will stop working.

Cheers, Steve.

And thats exactly what I believe is broken behavior. There is no good reason that /whatever should impact /whisper. Also, its not documented anywhere that there are special reserved starting letters for slash handlers.

Stv
May 22nd, 2022, 19:29
I asked a related question in this post
https://www.fantasygrounds.com/forums/showthread.php?55601-Slash-commands-working-correctly&p=490706&viewfull=1#post490706
and Moon Wizard said in post #2 that the shortcut versions only work if the shortcut is unique.

I agree this is far from ideal if you wish to use a new handler that starts with the same letter as an already existing handler.

Cheers, Steve.

Moon Wizard
May 23rd, 2022, 07:11
There is a different function you will want to use for registering slash handlers for CoreRPG layering. In order to provide the additional help text that CoreRPG supports, you will need to register like this:
ChatManager.registerSlashCommand("w", ChatManager.processWhisper, "[character] [message]");

If you use Comm.registerSlashHandler, it will match before falling through to the CoreRPG layer. Thus, the issue you are seeing. (i.e. your handler is registered in the client; so overrides anything with same letters in CoreRPG layer).

There are several examples in the ChatManager script in CoreRPG.

Regards,
JPG