[ModLog] Use custom scopes for ModLog Config (#2766)

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>
This commit is contained in:
Toby Harradine
2019-06-26 00:52:33 +10:00
committed by GitHub
parent 52f5d5cd6a
commit f91d8610ae
3 changed files with 201 additions and 144 deletions

View File

@@ -117,7 +117,7 @@ def main():
if cli_flags.dev:
red.add_cog(Dev())
# noinspection PyProtectedMember
modlog._init()
loop.run_until_complete(modlog._init())
# noinspection PyProtectedMember
bank._init()