prefix property

(FutureOr<Pattern> Function(MessageCreateEvent)?) prefix
final

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

This function should return a Pattern that should match the start of the message content if it begins with the prefix.

If this function is null, message commands are disabled.

For example, for a prefix of !:

(_) => '!'

Or, for either ! or $ as a prefix:

(_) => RegExp(r'!|\$')

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).

Implementation

final FutureOr<Pattern> Function(MessageCreateEvent)? prefix;