import yaml # YAML parser for Bot config files import asyncio # Discord Py Dependency import discord # Main Lib from discord.ext import commands # Commands module from discord_slash import SlashCommand, SlashContext, cog_ext, utils # Slash Command Library from discord_slash.utils.manage_commands import create_choice, create_option # Slash Command features import logging # logger and handler from bot import checkConfig, parseConfigCheck, configFile, setConfig, yaml_load, yaml_dump #### Actions for the bot to take when the Bot joins a guild. class on_guild_join(commands.Cog, name='On Guild Join Events'): def __init__(self, client): self.client = client @commands.Cog.listener() async def on_guild_join(self, guild): setConfig(guild) status, output = checkConfig(guild) conf = yaml_load(configFile) if not status: await guild.get_channel(conf[str(guild.id)]['channels']['mod']).send(f"```The Bot's configurations are incomplete for the guild `{guild.name}`. Some limited functions will still be available, but most features cannot be used until the configurations are complete.\n{parseConfigCheck(output)}\nYou can set these configuration values using the `/config` command.```") def setup(client): client.add_cog(on_guild_join(client))