diff options
| author | 2021-08-21 01:28:07 +0300 | |
|---|---|---|
| committer | 2021-08-21 01:28:07 +0300 | |
| commit | 34d7f7cc61be8b76bbc32fce1d6c8cbfc97b4cb8 (patch) | |
| tree | 8a88dc1ab613d5a1cd4248872c2ff8f806596dc5 /tests/test_base.py | |
| parent | Move max_interval to init (diff) | |
AntiSpam modified to work with cache
The anti-spam cog now uses a cache instead of reading channel history.
The cache is for all channels in the guild, and does not remove deleted messages.
That means that the anti-spam logic now works cross-channel and counts deleted messages.
The size of the cache is determined via a new field in the config YAML file.
The cache was implemented as a separate class, MessageCache, which uses circular buffer logic.
This allows for constant time addition and removal form either side, and lookup. The cache does not support removal from the middle of the cache.
The cache additionally stores a mapping from message ID's to the index of the message in the cache, to allow constant time lookup by message ID.
The commit additionally adds accompanying tests, and renames `cache.py` to `caching.py` to better distinguish it from the new `message_cache.py` and convey that it's for general caching utilities.
Diffstat (limited to 'tests/test_base.py')
0 files changed, 0 insertions, 0 deletions