mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Modlog was the biggest culprit for seriously large documents in the MongoDB backend, since it stored all cases as nested dicts in the guild scope. So, for example, on the Fortnite server, the guild document for Kowlin's bot had exceeded 8MB. This commit gives each case its own document. It also does the same for casetypes. Not only does it remove the possibility of the document exceeding the maximum size in MongoDB, it's also just more efficient for all backends. Other misc changes: Fixed a bunch of type-hints, and also added more support for when an object related to a case (user, moderator, channel etc.) can't be found (because it was deleted or something rather) Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
16 lines
313 B
Python
16 lines
313 B
Python
import pytest
|
|
from redbot.core import modlog
|
|
|
|
__all__ = ["mod"]
|
|
|
|
|
|
@pytest.fixture
|
|
async def mod(config, monkeypatch):
|
|
from redbot.core import Config
|
|
|
|
with monkeypatch.context() as m:
|
|
m.setattr(Config, "get_conf", lambda *args, **kwargs: config)
|
|
|
|
await modlog._init()
|
|
return modlog
|