prefix property Null safety

String Function(IMessage) prefix

A function called to determine the prefix for a specific message.

This function should return a String representing the prefix to use for a given message.

For example, for a prefix of !:

(_) => '!'

Or, for either ! or $ as a prefix:

(message) => message.content.startsWith('!') ? '!' : '$'

You might also be interested in:

  • dmOr, which allows for commands in private messages to omit the prefix;
  • mentionOr, which allows for commands to be executed with the client's mention (ping).


final String Function(IMessage) prefix;