From 28f9a61033c37f9db614a8ce8b3fb1f4fb6eeccc Mon Sep 17 00:00:00 2001 From: sgoudham Date: Sun, 26 Jul 2020 09:13:35 +0100 Subject: [PATCH] Updating commentary Adding modlogs channel to cache on guild_join and removing it from cache on guild_leave --- main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 2cd7de50..25817460 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,7 @@ import db import settings from cogs.help import HelpPaginator from settings import blank_space, enso_embedmod_colours, enso_guild_ID, enso_newpeople_ID, get_prefix_for_guild, \ - storage_prefix_for_guild, cache_prefix, del_cache_prefix + storage_prefix_for_guild, cache_prefix, del_cache_prefix, del_modlog_channel, cache_modlogs counter = 0 @@ -178,8 +178,10 @@ async def change_prefix(ctx, new: Optional[str] = None): async def on_guild_join(guild): """Store users in a database when the bot has joined a new guild""" - # Store default prefix within cache and database + # Store default prefix within cache cache_prefix(str(guild.id), prefix="~") + # Store default modlogs channel within cache + cache_modlogs(str(guild.id), channel=None) try: # Set up connection to database @@ -213,8 +215,9 @@ async def on_guild_join(guild): async def on_guild_remove(guild): """Remove users in the database for the guild""" - # Delete the key - value pair for the guild + # Delete the key - value pairs for the guild del_cache_prefix(str(guild.id)) + del_modlog_channel(str(guild.id)) try: # Set up connection to database