mentionOr function Null safety

String Function(IMessage) mentionOr(
  1. String defaultPrefix(
    1. IMessage

A Function that can be used as an input to CommandsPlugin.prefix to allow invoking commands by mentioning the bot.

The defaultPrefix parameter will be used if the message does not start with a mention.


String Function(IMessage) mentionOr(String Function(IMessage) defaultPrefix) {
  return (message) {
    RegExpMatch? match = _mentionPattern.firstMatch(message.content);

    if (match != null && message.client is INyxxWebsocket) {
      if (int.parse(!) == (message.client as INyxxWebsocket) {

    return defaultPrefix(message);