DEAFULT = {
    'assets':{
        '__init__.py':''
    },
    'src':{
        '__init__.py':''
    },
    'README.md':[
        r"# -DEAFULT-PROJECT-",
        r"use it to make something incredible!"
    ],
    'main.py':r'import team4958_customs',
    'requirements.txt':''
}



DISNAKE = {
    'assets':{
        '__init__.py':''
    },
    'src':{
        'extensions':{
            'commands':{
                'blank':{
                    '__command__slash_cmd.py':[
                        r'"""common slash command template"""',
                        r'',
                        r'',
                        r'',
                        r'import disnake',
                        r'from disnake.ext import commands',
                        r'',
                        r'',
                        r'',
                        r'class slash_cmd(commands.Cog):',
                        r'',
                        r'    def __init__(self, bot):',
                        r'        self.bot = bot',
                        r'',
                        r'    @commands.slash_command(description="cmd description sample")',
                        r'    async def slash_cmd(self, inter):',
                        r'        await inter.send(f"slash-command sample", ephemeral=True)',
                        r'',
                        r'',
                        r'',
                        r'def setup(bot):',
                        r'    bot.add_cog(slash_cmd(bot))'
                    ],
                    '__init__.py':r'"""command templates"""'
                },
                '__init__.py':r'"""bot commands"""'
            },
            'events':{
                '__event__start.py':[
                    r'import logging',
                    r'',
                    r'from disnake.ext import commands',
                    r'',
                    r'',
                    r'',
                    r'log = logging.getLogger(__name__)',
                    r'',
                    r'',
                    r'',
                    r'class start(commands.Cog):',
                    r'',
                    r'    def __init__(self, bot):',
                    r'        self.bot = bot',
                    r'',
                    r'    @commands.Cog.listener()',
                    r'    async def on_ready(self):',
                    r"        log.critical(f'started {self.bot.user}')",
                    r"        print(f'started {self.bot.user}')",
                    r'',
                    r'',
                    r'',
                    r'def setup(bot):',
                    r'    bot.add_cog(start(bot))'
                ],
                '__init__.py':r'"""bot events to listen to"""'
            },
            '__init__.py':r'"""loadable bot extensions"""'
        },
        'utils':{
            'logging':{
                '__init__.py':'',
                'logger_setup.py':[
                    r'"""logging setup presets"""',
                    r'',
                    r'',
                    r'',
                    r'import logging',
                    r'from logging.handlers import TimedRotatingFileHandler',
                    r'',
                    r'import pathlib',
                    r'from pathlib import Path',
                    r'',
                    r'import os',
                    r'',
                    r'',
                    r'',
                    r'def normal(name):',
                    r'    """ALWAYS put __name__ as arg!!"""',
                    r'    if not os.path.isdir("logs"):',
                    r'        os.mkdir("logs")',
                    r"    file = Path(pathlib.Path.cwd(), 'logs', 'exc.log')",
                    r'''    logging.basicConfig(level=logging.WARNING, filename=file, filemode="a", format='%(asctime)s %(name)s %(levelname)s:%(message)s')''',
                    r'    logging.debug("A DEBUG Message")',
                    r'    logging.info("An INFO")',
                    r'    logging.warning("A WARNING")',
                    r'    logging.error("An ERROR")',
                    r'    logging.critical("A message of CRITICAL severity")',
                    r"    TimedRotatingFileHandler(filename=file, when='d', interval=1, backupCount=7)",
                    r'    return logging.getLogger(name)',
                    r'',
                    r'def debug(name):',
                    r'    """ALWAYS put __name__ as arg!!"""',
                    r'    if not os.path.isdir("logs"):',
                    r'        os.mkdir("logs")',
                    r"    file = Path(pathlib.Path.cwd(), 'logs', 'exc.log')",
                    r'''    logging.basicConfig(level=logging.DEBUG, filename=file, filemode="a", format='%(asctime)s %(name)s %(levelname)s:%(message)s')''',
                    r'    logging.debug("A DEBUG Message")',
                    r'    logging.info("An INFO")',
                    r'    logging.warning("A WARNING")',
                    r'    logging.error("An ERROR")',
                    r'    logging.critical("A message of CRITICAL severity")',
                    r"    TimedRotatingFileHandler(filename=file, when='d', interval=1, backupCount=7)",
                    r'    return logging.getLogger(name)',
                    r'',
                    r'def test(name):',
                    r'    """ALWAYS put __name__ as arg!!"""',
                    r'    if not os.path.isdir("logs"):',
                    r'        os.mkdir("logs")',
                    r"    file = Path(pathlib.Path.cwd(), 'logs', 'exc.log')",
                    r'''    logging.basicConfig(level=logging.INFO, filename=file, filemode="a", format='%(asctime)s %(name)s %(levelname)s:%(message)s')''',
                    r'    logging.debug("A DEBUG Message")',
                    r'    logging.info("An INFO")',
                    r'    logging.warning("A WARNING")',
                    r'    logging.error("An ERROR")',
                    r'    logging.critical("A message of CRITICAL severity")',
                    r"    TimedRotatingFileHandler(filename=file, when='d', interval=1, backupCount=7)",
                    r'    return logging.getLogger(name)'
                ]
            },
            '__init__.py':r'"""custom cog utils"""',
            'funcs.py':[
                r'"""custom python objects"""',
                r'',
                r'',
                r'',
                r'import logging',
                r'',
                r'',
                r'',
                r'log = logging.getLogger(__name__)',
                r'',
                r'',
                r'',
                r'#put some custom classes and functions here'
            ],
            'parsher.py':[
                r'"""deafult messages and embeds"""',
                r'',
                r'',
                r'',
                r'import disnake',
                r'',
                r'',
                r'',
                r'def create_embeds(emb_dicts):',
                r'    """creates a list of disnake embeds from list of dicts"""',
                r'    res = []',
                r'    for element in emb_dicts:',
                r'        embed = disnake.Embed.from_dict(element)',
                r'        res.append(embed)',
                r'    if len(res)>0:',
                r'        return res',
                r'    else:',
                r'        embed = disnake.Embed.from_dict({"title": "Embed Title","title": "Embed Title","color": 0xFEE75C})',
                r'        return [embed]',
                r'',
                r'',
                r'',
                r'"""embed dictionaries"""',
                r'"""',
                r'to set use:',
                r'    embed=disnake.Embed.from_dict(template)',
                r'"""',
                r'"""',
                r'embed_dict = {',
                r'    "title": "Embed Title",',
                r'   "description": "Embed Description",',
                r'    "color": 0xFEE75C,',
                r'    "timestamp": datetime.datetime.now().isoformat(),',
                r'    "author": {',
                r'        "name": "Embed Author",',
                r'        "url": "https://disnake.dev/",',
                r'        "icon_url": "https://disnake.dev/assets/disnake-logo.png",',
                r'    },',
                r'    "thumbnail": {"url": "https://disnake.dev/assets/disnake-logo.png"},',
                r'    "fields": [',
                r'        {"name": "Regular Title", "value": "Regular Value", "inline": "false"},',
                r'        {"name": "Inline Title", "value": "Inline Value", "inline": "true"},',
                r'        {"name": "Inline Title", "value": "Inline Value", "inline": "true"},',
                r'        {"name": "Inline Title", "value": "Inline Value", "inline": "true"},',
                r'    ],',
                r'    "image": {"url": "https://disnake.dev/assets/disnake-banner-thin.png"},',
                r'    "footer": {"text": "Embed Footer", "icon_url": "https://disnake.dev/assets/disnake-logo.png"},',
                r'}',
                r'"""'
            ]
        },
       '__init__.py':r'"""bot source code root folder"""'
    },
    'config.py':[
        r'TOKEN = "" #test bot token',
        r'',
        r'',
        r'',
        r'#DISCORD CONFIG',
        r"emb_image_none = 'https://cdn.discordapp.com/attachments/990257257986027550/1014942594448502894/5PAAPj7.png' #just an empty image",
        r'ds_col = 0x2f3136 #discord background color',
        r'guild_id = ... #discord guild id',
        r'server_pic = ... #server picture',
        r'',
        r'',
        r'',
        r'#your database config',
        r'db_config = {',
        r"    'mysql': { #bot's main db config",
        r"        'host': 'localhost',",
        r"        'user': '',",
        r"        'passwd': '',",
        r"        'user2': '',",
        r"        'passwd2': '',",
        r"        'database': '',",
        r"        'tables':[",
        r"            'table (column TYPE, column TYPE)'",
        r"        ]",
        r'    },',
        r"    'root_config': { #mysql server root user config",
        r"        'host': 'localhost',",
        r"        'user': 'root',",
        r"        'password': ''",
        r"    }",
        r'}',
        r'',
        r'',
        r'',
        r'#some common things',
        r"version = '0.0.0 (blank)'"
    ],
    'main.py':[
        r"import os",
        r'import sys',
        r'',
        r"if str(os.name)=='posix':",
        r'    os.system("python3 -m pip install -r requirements.txt")',
        r"elif str(os.name)=='nt':",
        r'    os.system("py -m pip install -r requirements.txt")',
        r'else:',
        r'    print("unknown os type, cannot launch")',
        r'    sys.exit()',
        r'',
        r'',
        r'',
        r'import traceback',
        r'from team4958_customs.utils import *',
        r'',
        r'',
        r'',
        r'def database():',
        r'    from team4958_customs.utils import _yesornot',
        r'    create = _yesornot("do you wish to create a database for your bot?")',
        r'    if create == True:',
        r'        from team4958_customs.tools.sql import Administration',
        r'        from config import db_config',
        r'        from mysql.connector import Error as sqlErr',
        r"        sql = Administration(db_config['mysql'], mysql_config=db_config['root_conf'])",
        r'        try:',
        r'            sql.create_db(add_tables=False)',
        r'        except sqlErr:',
        r'            print(f"failed to database!\n{traceback.print_exc()}")',
        r'        try:',
        r'            sql.create_tables()',
        r'        except sqlErr:',
        r'            print(f"failed to create tables in your database!\n{traceback.print_exc()}")',
        r'        try:',
        r'            sql.create_users()',
        r'        except sqlErr:',
        r'            print(f"failed to create users in your database!\n{traceback.print_exc()}")',
        r'database()',
        r'',
        r'',
        r'',
        r'from pathlib import Path',
        r'from src.utils.logging import logger_setup as logger',
        r'',
        r'',
        r'',
        r'def launch_mode():',
        r"    print('enter DEBUG mode? (y/n)', end='')",
        r"    mode = input()",
        r"    if mode == 'y' or mode == 'Y':",
        r'        print("starting debug mode...")',
        r"        output = Path(ROOT, 'logs', 'console.txt')",
        r"        sys.stdout = open(output, 'w')",
        r"        sys.stderr = open(output, 'w')",
        r"        return logger.debug(__name__)",
        r"    elif mode == 'n' or mode == 'N':",
        r'        print("starting normal...")',
        r"        output = Path(ROOT, 'logs', 'console.txt')",
        r"        sys.stdout = open(output, 'w')",
        r"        sys.stderr = open(output, 'w')",
        r'        return logger.normal(__name__)',
        r'    else:',
        r'        return logger.test(__name__)',
        r'log = launch_mode()',
        r'',
        r'',
        r'',
        r'import disnake',
        r'from disnake.ext import commands',
        r'from os import walk',
        r'from config import Token',
        r'',
        r'',
        r'',
        r'bot = commands.InteractionBot(intents= disnake.Intents.all())',
        r'',
        r'',
        r'',
        r"src_root = Path(ROOT, 'src', 'extensions')",
        r'loadlist = ["__command__", "__event__"]',
        r'def loadable(file):',
        r'    if file.endswith(".py"):',
        r'        for ext in loadlist:',
        r'            if file.startswith(ext):',
        r'                return True',
        r'    else:',
        r'        return',
        r'for (dirpath, dirnames, filenames) in walk(src_root):',
        r'    for filename in os.listdir(dirpath):',
        r'        if loadable(filename):',
        r'            path = Path(dirpath, filename)',
        r'            strpath = str(path)',
        r"            strpath = strpath.replace(str(Path(ROOT)), '')",
        r'            for char in [r"\\", r"\ "[0], "/", "//"]:',
        r'                if char in strpath:',
        r"                    ext = strpath.replace(char, '.')",
        r"                    ext = ext.replace(ext[0], '', 1)",
        r'            bot.load_extension(ext[:-3])',
        r'            print(f"extension {filename[:-3]} loaded!")',
        r'            log.warning(f"extension {filename[:-3]} loaded!")',
        r'',
        r'',
        r'',
        r'bot.run(Token)'
    ],
    'README.md':[
        r"# -Disnake-bot-BLANK-",
        r"template for disnake bot",
        r"",
        r"## get started",
        r"",
        r"log folder `'./logs'` will be created automatically on start if not exist!",
        r"",
        r"only files from `'./src/extensions'` folder and all its subfolders with `'__command__'` and `'__event__'` in their names *as prefix* are being loaded as disnake bot extensions!!"
    ],
    'requirements.txt':[
        r'disnake',
        r'team4958-customs'
    ]
}