preCallHooks property

  1. @override
Iterable<void Function(CommandContext)> preCallHooks
getter/setter pairoverride-getter

An iterable of callbacks executed before a command is executed but after all the checks for that command have succeeded.

These callbacks should be used to update this check's state.

You might also be interested in:

Implementation

@override
late Iterable<void Function(CommandContext)> preCallHooks = [
  (context) {
    int key = getKey(context);

    if (_previousBucket.containsKey(key) && _isActive(_previousBucket[key]!)) {
      _previousBucket[key]!.count++;
    } else if (_currentBucket.containsKey(key)) {
      _currentBucket[key]!.count++;
    } else {
      _currentBucket[key] = _BucketEntry(DateTime.now());
    }
  }
];