onCommandHelp

Sends a list of all plugins' commands to the requesting user.

Plugins don't know about other plugins; the only thing they know of the outside world is the thread ID of the main thread ID (stored in IRCPluginState.mainThread). As such, we can't easily query each plugin for their IRCEventHandler.Command-annotated functions.

To work around this we construct a delegate that accepts an array of IRCPlugins, and pass it to the main thread. It will then invoke the delegate with the client-global plugins array as argument.

Once we have the list we format it nicely and send it back to the requester.

version(WithHelpPlugin)
private
@IRCEventHandler().onEvent(IRCEvent.Type.CHAN).onEvent(IRCEvent.Type.QUERY).permissionsRequired(Permissions.anyone).channelPolicy(ChannelPolicy.home).addCommand(IRCEventHandler.Command().word("help").policy(PrefixPolicy.prefixed).description("Shows a list of all available commands.").addSyntax("$command [plugin] [command]").addSyntax("$command [prefixed command]"))
void
onCommandHelp