mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2026-01-22 16:12:59 -05:00
[V3 Config] Record custom group information using cog_add event (#2550)
* Do things differently * Uncomment critical lines * Reduce, reuse, recycle * Check groups on all new config objects after a cog loads * I don't know why this is failing now or why we need the global keyword * gotta fix this too
This commit is contained in:
@@ -15,6 +15,7 @@ from pkg_resources import DistributionNotFound
|
||||
|
||||
from .. import __version__ as red_version, version_info as red_version_info, VersionInfo
|
||||
from . import commands
|
||||
from .config import get_latest_confs
|
||||
from .data_manager import storage_type
|
||||
from .utils.chat_formatting import inline, bordered, format_perms_list, humanize_timedelta
|
||||
from .utils import fuzzy_command_search, format_fuzzy_results
|
||||
@@ -305,6 +306,14 @@ def init_events(bot, cli_flags):
|
||||
if command_obj is not None:
|
||||
command_obj.enable_in(guild)
|
||||
|
||||
@bot.event
|
||||
async def on_cog_add(cog: commands.Cog):
|
||||
confs = get_latest_confs()
|
||||
for c in confs:
|
||||
uuid = c.unique_identifier
|
||||
group_data = c.custom_groups
|
||||
await bot.db.custom("CUSTOM_GROUPS", c.cog_name, uuid).set(group_data)
|
||||
|
||||
|
||||
def _get_startup_screen_specs():
|
||||
"""Get specs for displaying the startup screen on stdout.
|
||||
|
||||
Reference in New Issue
Block a user