Ejemplo n.º 1
0
    async def _reload(self, module):
        """Reloads a module

        Example: reload audio"""
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That module cannot be found.")
        except NoSetupError:
            await self.bot.say("That module does not have a setup function.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("That module could not be loaded. Check your"
                               " console or logs for more information.\n\n"
                               "Error: `{}`".format(e.args[0]))
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Module reloaded.")
Ejemplo n.º 2
0
 async def _install(self, ctx, repo_name: str, cog: str):
     """Installs specified cog"""
     if repo_name not in self.repos:
         await self.bot.say("That repo doesn't exist.")
         return
     if cog not in self.repos[repo_name]:
         await self.bot.say("That cog isn't available from that repo.")
         return
     install_cog = await self.install(repo_name, cog)
     if install_cog:
         await self.bot.say("Installation completed. Load it now? (yes/no)")
         answer = await self.bot.wait_for_message(timeout=15,
                                                  author=ctx.message.author)
         if answer is None:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
         elif answer.content.lower().strip() == "yes":
             set_cog("cogs." + cog, True)
             self.bot.unload_extension("cogs." + cog)
             self.bot.load_extension("cogs." + cog)
             await self.bot.say("Done.")
         else:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
     elif install_cog is False:
         await self.bot.say("Invalid cog. Installation aborted.")
     else:
         await self.bot.say("That cog doesn't exist. Use cog list to see"
                            " the full list.")
Ejemplo n.º 3
0
    async def _reload(self, module):
        """Reloads a module

        Example: reload audio"""
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That module cannot be found.")
        except NoSetupError:
            await self.bot.say("That module does not have a setup function.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("That module could not be loaded. Check your"
                               " console or logs for more information.\n\n"
                               "Error: `{}`".format(e.args[0]))
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Module reloaded.")
Ejemplo n.º 4
0
    async def load(self, *, cog_name: str):
        """Loads a cog

        Example: load mod"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That cog could not be found.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the cog. Check"
                               " your console or logs for more information.")
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Cog was found and possibly loaded but '
                               'something went wrong. Check your console '
                               'or logs for more information.')
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("The cog has been loaded.")
Ejemplo n.º 5
0
    async def load(self, *, module: str):
        """Loads a module

        Example: load mod"""
        colour = ''.join([random.choice('0123456789ABCDEF') for x in range(6)])
        colour = int(colour, 16)
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say(
                ":bangbang: **That module could not be found.** :x:")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(embed=discord.Embed(
                description="There was an issue loading the module.```py\n{}```"
                .format(e),
                colour=discord.Colour(value=colour)))
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(embed=discord.Embed(
                description='Module was found and possibly loaded but '
                'something went wrong.```py\n{}```'.format(e),
                colour=discord.Colour(value=colour)))
        else:
            set_cog(module, True)
            await self.disable_commands()
            em = discord.Embed(description="Module Loaded.",
                               colour=discord.Colour(value=colour))
            await self.bot.say(embed=em)
Ejemplo n.º 6
0
 async def load(self, *, cog_name: str):
     """기능을 불러옵니다!
     
     예시: k!load mod"""
     module = cog_name.strip()
     if "cogs." not in module:
         module = "cogs." + module
     try:
         self._load_cog(module)
     except CogNotFoundError:
         await self.bot.say("그 기능은 존재 하지 않는 기능입니다")
     except CogLoadError as e:
         log.exception(e)
         traceback.print_exc()
         await self.bot.say("그 기능을 불러오는 도중 에러가 발생하였습니다!\n콘솔 혹은 터미널을 확인해주세요!"
                            )
     except Exception as e:
         log.exception(e)
         traceback.print_exc()
         await self.bot.say("그 기능을 불러오는 도중 에러가 발생하였습니다!\n콘솔 혹은 터미널을 확인해주세요!"
                            )
     else:
         set_cog(module, True)
         await self.disable_commands()
         await self.bot.say("기능이 추가 되었습니다!")
Ejemplo n.º 7
0
 async def _install(self, ctx, repo_name: str, cog: str):
     """Installs specified cog"""
     if repo_name not in self.repos:
         await self.bot.say("That repo doesn't exist.")
         return
     if cog not in self.repos[repo_name]:
         await self.bot.say("That cog isn't available from that repo.")
         return
     install_cog = await self.install(repo_name, cog)
     data = self.get_info_data(repo_name, cog)
     if data is not None:
         install_msg = data.get("INSTALL_MSG", None)
         if install_msg is not None:
             await self.bot.say(install_msg[:2000])
     if install_cog:
         await self.bot.say("Installation completed. Load it now? (yes/no)")
         answer = await self.bot.wait_for_message(timeout=15,
                                                  author=ctx.message.author)
         if answer is None:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
         elif answer.content.lower().strip() == "yes":
             set_cog("cogs." + cog, True)
             owner = self.bot.get_cog('Owner')
             await owner.load.callback(owner, module=cog)
         else:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
     elif install_cog is False:
         await self.bot.say("Invalid cog. Installation aborted.")
     else:
         await self.bot.say("That cog doesn't exist. Use cog list to see"
                            " the full list.")
Ejemplo n.º 8
0
    async def _reload(self, *, cog_name: str):
        """Reloads a cog

        Example: reload audio"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That cog cannot be found.")
        except NoSetupError:
            await self.bot.say("That cog does not have a setup function.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("That cog could not be loaded. Check your"
                               " console or logs for more information.")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("The cog has been reloaded.")
Ejemplo n.º 9
0
    async def _reload(self, *, cog_name: str):
        """Przeładowuje moduł

        przykład: reload audio"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("Nie znalazłem modułu.")
        except NoSetupError:
            await self.bot.say("Ten moduł nie ma funkcji startowej.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("Był problem z wczytaywaniem modułu. Sprawdź"
                               " Konsole.")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Przeładowano moduł.")
Ejemplo n.º 10
0
    async def load(self, *, cog_name: str):
        """Charge un plugin

        Exemple: !load mod"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("Ce plugin n'a pas pus être trouvé.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(
                "Un problème est survenu lors du chargement du plugin. Vérifiez"
                " la console ou les logs pour plus d'informations")
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(
                ' Plugin trouvé et éventuellement chérgé mais '
                'Quelque chose a causé un problème. Vérifiez votre console  '
                'ou vos logs')
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Le plugin a été chargé")
Ejemplo n.º 11
0
    async def unload(self, *, cog_name: str):
        """Décharge un plugin

        Exemple: !unload mod"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module
        if not self._does_cogfile_exist(module):
            await self.bot.say(
                "Ce plugin n'existe pas. Je ne vais pas"
                " désactiver le démarrage automatique"
                " au cas où pour éviter que cela ne se reproduise.")
        else:
            set_cog(module, False)
        try:  # No matter what we should try to unload it
            self._unload_cog(module)
        except OwnerUnloadWithoutReloadError:
            await self.bot.say(
                "Je ne peux pas vous permettre de décharger le plugin Owner"
                " sauf si vous êtes en train de recharger.")
        except CogUnloadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(
                'Impossible de décharger ce plugin en toute sécurité.')
        else:
            await self.bot.say("Le plugin a été déchargé.")
Ejemplo n.º 12
0
    async def _reload(self, *, cog_name: str):
        """Recharge un plugin

        Exemple: !reload audio"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("Ce plugin ne peut être trouvé.")
        except NoSetupError:
            await self.bot.say(
                "Ce plugin n'a pas de fonction de configuration.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(
                "Ce plugin n'a pas pu être chargé. Vérifier votre"
                " console ou les logs")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Le plugin a été rechargé.")
Ejemplo n.º 13
0
    async def load(self, *, cog_name: str):
        """Loads a cog

        Example: load mod"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That cog could not be found.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the cog. Check"
                               " your console or logs for more information.")
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Cog was found and possibly loaded but '
                               'something went wrong. Check your console '
                               'or logs for more information.')
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("The cog has been loaded.")
 async def load(self, *, module: str):
     """Loads a Module
     Example: [p]load Mod (where [p] = Prefix)
     """
     module = module.strip()
     if "cogs." not in module:
         module = "cogs." + module
     try:
         self._load_cog(module)
     except CogNotFoundError:
         await self.bot.say("That Module could not be found :crying_cat_face:")
     except CogLoadError as e:
         log.exception(e)
         traceback.print_exc()
         await self.bot.say("There was an issue loading this module :crying_cat_face:. "
                            "Check your console or logs for more information\n"
                            "\nError: '{}'".format(e.args[0]))
     except Exception as e:
         log.exception(e)
         traceback.print_exc()
         await self.bot.say('Module was found and possibly loaded but '
                            'something went wrong. Check your console '
                            'or logs for more information.\n\n'
                            'Error: `{}`'.format(e.args[0]))
     else:
         set_cog(module, True)
         await self.disabled_commands()
         await self.bot.say("Module Enabled. Have fun! :smiley_cat:")
Ejemplo n.º 15
0
 async def _install(self, ctx, repo_name: str, cog: str):
     """Installs specified cog"""
     if repo_name not in self.repos:
         await self.bot.say("That repo doesn't exist.")
         return
     if cog not in self.repos[repo_name]:
         await self.bot.say("That cog isn't available from that repo.")
         return
     install_cog = await self.install(repo_name, cog)
     data = self.get_info_data(repo_name, cog)
     if data is not None:
         install_msg = data.get("INSTALL_MSG", None)
         if install_msg is not None:
             await self.bot.say(install_msg[:2000])
     if install_cog:
         await self.bot.say("Installation completed. Load it now? (yes/no)")
         answer = await self.bot.wait_for_message(timeout=15,
                                                  author=ctx.message.author)
         if answer is None:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
         elif answer.content.lower().strip() == "yes":
             set_cog("cogs." + cog, True)
             owner = self.bot.get_cog('Owner')
             await owner.load.callback(owner, module=cog)
         else:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
     elif install_cog is False:
         await self.bot.say("Invalid cog. Installation aborted.")
     else:
         await self.bot.say("That cog doesn't exist. Use cog list to see"
                            " the full list.")
Ejemplo n.º 16
0
    async def load(self, *, cog_name: str):
        """Ładuje moduł

        Przykład: load mod"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("Ten moduł nie istnieje.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("Był problem z wczytaywaniem modułu. Sprawdź"
                               " konsole albo logi.")
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(
                'Moduł został znaleziony i może załadowany, ale '
                'coś poszło nie tak, sprawdź logi albo konsole ')
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Moduł został załadowany.")
Ejemplo n.º 17
0
 async def _install(self, ctx, cog: str):
     """Installs specified cog"""
     install_cog = await self.install(cog)
     if install_cog:
         await self.bot.say("Installation completed. Load it now? (yes/no)")
         answer = await self.bot.wait_for_message(timeout=15,
                                                  author=ctx.message.author)
         if answer is None:
             await self.bot.say(
                 "Ok then, you can load it with `{}load {}`".format(
                     ctx.prefix, cog))
         elif answer.content.lower().strip() in ["yes", "y"]:
             set_cog("cogs." + cog, True)
             self.bot.unload_extension("cogs." + cog)
             self.bot.load_extension("cogs." + cog)
             await self.bot.say("Done.")
         else:
             await self.bot.say(
                 "Ok then, you can load it with `{}load {}`".format(
                     ctx.prefix, cog))
     elif install_cog == False:
         await self.bot.say("Invalid cog. Installation aborted.")
     else:
         await self.bot.say(
             "That cog doesn't exist. Use cog list to see the full list.")
Ejemplo n.º 18
0
    async def load(self, ctx, *, module: str):
        """Loads a module

        Example: load mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say(
                ":bangbang: **That module could not be found.** :x:")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the module. Check"
                               " your console or logs for more information.\n"
                               "\nError: `{}`".format(e.args[0]))
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Module was found and possibly loaded but '
                               'something went wrong. Check your console '
                               'or logs for more information.\n\n'
                               'Error: `{}`'.format(e.args[0]))
        else:
            set_cog(module, True)
            await self.disable_commands()
            em = discord.Embed(
                description=
                ":thumbsup:   :regional_indicator_m: :regional_indicator_o: :regional_indicator_d: :regional_indicator_u: :regional_indicator_l: :regional_indicator_e:   :regional_indicator_l: :regional_indicator_o: :regional_indicator_a: :regional_indicator_d: :regional_indicator_e: :regional_indicator_d:   :thumbsup: ",
                color=discord.Color.green())
            await self.bot.send_message(ctx.message.channel, embed=em)
Ejemplo n.º 19
0
 async def _install(self, ctx, repo_name: str, cog: str):
     """Installs specified cog"""
     if repo_name not in self.repos:
         await self.bot.say("That repo doesn't exist.")
         return
     if cog not in self.repos[repo_name]:
         await self.bot.say("That cog isn't available from that repo.")
         return
     install_cog = await self.install(repo_name, cog)
     if install_cog:
         await self.bot.say("Installation completed. Load it now? (yes/no)")
         answer = await self.bot.wait_for_message(timeout=15,
                                                  author=ctx.message.author)
         if answer is None:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
         elif answer.content.lower().strip() == "yes":
             set_cog("cogs." + cog, True)
             self.bot.unload_extension("cogs." + cog)
             self.bot.load_extension("cogs." + cog)
             await self.bot.say("Done.")
         else:
             await self.bot.say("Ok then, you can load it with"
                                " `{}load {}`".format(ctx.prefix, cog))
     elif install_cog is False:
         await self.bot.say("Invalid cog. Installation aborted.")
     else:
         await self.bot.say("That cog doesn't exist. Use cog list to see"
                            " the full list.")
Ejemplo n.º 20
0
    async def _reload(self, ctx, module):
        """Reloads a module

        Example: reload audio"""
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("**Module** ***Not found 404 !!! PANICCC***")
        except NoSetupError:
            await self.bot.say("Bruh No setup function. :face_palm:")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("That module could not be loaded. Check your"
                               " console or logs for more information.\n\n"
                               "Error: `{}`".format(e.args[0]))
        else:
            set_cog(module, True)
            await self.disable_commands()
            em = discord.Embed(
                description=
                ":arrows_counterclockwise:    :regional_indicator_m: :regional_indicator_o: :regional_indicator_d: :regional_indicator_u: :regional_indicator_l: :regional_indicator_e:     :regional_indicator_r: :regional_indicator_e: :regional_indicator_l: :regional_indicator_o: :regional_indicator_a: :regional_indicator_d: :regional_indicator_e: :regional_indicator_d:   :arrows_counterclockwise: ",
                color=discord.Color.purple())
            await self.bot.send_message(ctx.message.channel, embed=em)
Ejemplo n.º 21
0
    async def _reload(self, *, cog_name: str):
        """Reloads a cog

        Example: reload audio"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That cog cannot be found.")
        except NoSetupError:
            await self.bot.say("That cog does not have a setup function.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("That cog could not be loaded. Check your"
                               " console or logs for more information.")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("The cog has been reloaded.")
Ejemplo n.º 22
0
    async def _reload(self, *, cog_name: str):
        """Reloads a module

        Example: reload audio"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("```Module does not exist, idiot.```")
        except NoSetupError:
            await self.bot.say("```Module lacks setup capabilities, fool.```")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say(
                "```Failed to Reload Module! Check Development logs```")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("```Module Reloaded. Keep her running!```")
Ejemplo n.º 23
0
    async def load(self, *, module: str):
        """Loads a module

        Example: load mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That module could not be found.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the module."
                               " Check your logs for more information.")
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Module was found and possibly loaded but '
                               'something went wrong.'
                               ' Check your logs for more information.')
        else:
            set_cog(module, True)
            await self.bot.say("Module enabled.")
Ejemplo n.º 24
0
    async def _reload(self, *, cog_name: str):
        """Recharge un module"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("Le module est introuvable.")
        except NoSetupError:
            await self.bot.say("Ce module n'a pas de fonction 'setup' permettant son redémarrage.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("Ce module n'a pas pu être rechargé. Renseignez-vous auprès du terminal.")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Ce module à été rechargé.")
Ejemplo n.º 25
0
    async def unload(self, *, module: str):
        """Unloads a module

        Example: unload mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        if not self._does_cogfile_exist(module):
            await self.bot.say("That module file doesn't exist. I will not"
                               " turn off autoloading at start just in case"
                               " this isn't supposed to happen.")
        else:
            set_cog(module, False)
        try:  # No matter what we should try to unload it
            self._unload_cog(module)
        except OwnerUnloadWithoutReloadError:
            await self.bot.say("I cannot allow you to unload the Owner plugin"
                               " unless you are in the process of reloading.")
        except CogUnloadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Unable to safely disable that module.')
        else:
            await self.bot.say(
                ":x:   :regional_indicator_m: :regional_indicator_o: :regional_indicator_d: :regional_indicator_u: :regional_indicator_l: :regional_indicator_e:    :regional_indicator_u: :regional_indicator_n: :regional_indicator_l: :regional_indicator_o: :regional_indicator_a: :regional_indicator_d: :regional_indicator_e: :regional_indicator_d:   :negative_squared_cross_mark:"
            )
Ejemplo n.º 26
0
    async def _reload(self, *, cog_name: str):
        """기능을 리로드 합니다!

        예시: reload audio"""
        module = cog_name.strip()
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("그 기능을 찾을 수 없습니다.")
        except NoSetupError:
            await self.bot.say("그 기능은 먼저 설치를 하셔아 합니다.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("그 기능을 로드중 오류가 발생했습니다."
                               " 콘솔 혹은 터미널을 확인해주세요.")
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("이 기능은 리로드되었습니다.")
Ejemplo n.º 27
0
    async def load(self, *, module: str):
        """Loads a module

        Example: load mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That module could not be found.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the module. Check"
                               " your console or logs for more information.\n"
                               "\nError: `{}`".format(e.args[0]))
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Module was found and possibly loaded but '
                               'something went wrong. Check your console '
                               'or logs for more information.\n\n'
                               'Error: `{}`'.format(e.args[0]))
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Module enabled.")
Ejemplo n.º 28
0
    async def load(self, *, module: str):
        """Loads a module

        Example: load mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That module could not be found.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the module."
                               " Check your logs for more information.")
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Module was found and possibly loaded but '
                               'something went wrong.'
                               ' Check your logs for more information.')
        else:
            set_cog(module, True)
            await self.bot.say("Module enabled.")
Ejemplo n.º 29
0
    async def load(self, *, module: str):
        """Loads a module

        Example: load mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        try:
            self._load_cog(module)
        except CogNotFoundError:
            await self.bot.say("That module could not be found.")
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say("There was an issue loading the module. Check"
                               " your console or logs for more information.\n"
                               "\nError: `{}`".format(e.args[0]))
        except Exception as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Module was found and possibly loaded but '
                               'something went wrong. Check your console '
                               'or logs for more information.\n\n'
                               'Error: `{}`'.format(e.args[0]))
        else:
            set_cog(module, True)
            await self.disable_commands()
            await self.bot.say("Module enabled.")
Ejemplo n.º 30
0
    async def _reload(self, module):
        """Reloads a module

        Example: reload audio"""
        if "cogs." not in module:
            module = "cogs." + module

        try:
            self._unload_cog(module, reloading=True)
        except:
            pass

        try:
            self._load_cog(module)
        except CogNotFoundError:
            em = discord.Embed(description="That module cannot be found.",
                               colour=discord.Colour(value=colour))
            await self.bot.say(embed=em)
        except NoSetupError:
            em = discord.Embed(
                description="That module does not have a setup function.",
                colour=discord.Colour(value=colour))
            await self.bot.say(embed=em)
        except CogLoadError as e:
            log.exception(e)
            traceback.print_exc()
            em = discord.Embed(description="{}".format(e),
                               colour=discord.Colour(value=colour))
            await self.bot.say(embed=em)
        else:
            set_cog(module, True)
            await self.disable_commands()
            em = discord.Embed(description="Module reloaded.",
                               colour=discord.Colour(value=colour))
            await self.bot.say(embed=em)
 async def uninstall(self, ctx, repo_name, cog):
     """Uninstalls a cog"""
     if repo_name not in self.repos:
         await self.bot.say("That repo doesn't exist.")
         return
     if cog not in self.repos[repo_name]:
         await self.bot.say("That cog isn't available from that repo.")
         return
     set_cog("cogs." + cog, False)
     self.repos[repo_name][cog]['INSTALLED'] = False
     self.save_repos()
     os.remove(os.path.join("cogs", cog + ".py"))
     owner = self.bot.get_cog('Owner')
     await owner.unload.callback(owner, cog_name=cog)
     await self.bot.say("Cog successfully uninstalled.")
Ejemplo n.º 32
0
 async def uninstall(self, ctx, repo_name, cog):
     """Uninstalls a cog"""
     if repo_name not in self.repos:
         await self.bot.say("That repo doesn't exist.")
         return
     if cog not in self.repos[repo_name]:
         await self.bot.say("That cog isn't available from that repo.")
         return
     set_cog("cogs." + cog, False)
     self.repos[repo_name][cog]['INSTALLED'] = False
     self.save_repos()
     os.remove(os.path.join("cogs", cog + ".py"))
     owner = self.bot.get_cog('Owner')
     await owner.unload.callback(owner, module=cog)
     await self.bot.say("Cog successfully uninstalled.")
Ejemplo n.º 33
0
    async def loadallcogs(self, ctx):
        cogs = ['RpadUtils', 'AutoMod2', 'ChannelMod', 'Donations', 'FancySay', 'Memes',
                'PadBoard', 'Profile', 'Stickers', 'StreamCopy', 'Translate', 'VoiceRole',
                'Dadguide', 'PadEvents', 'PadGlobal', 'PadInfo', 'PadRem']

        owner_cog = self.bot.get_cog('Owner')

        for cog_name in cogs:
            cog = self.bot.get_cog(cog_name)
            if cog is None:
                await self.bot.say('{} not loaded, trying to load it...'.format(cog_name))
                try:
                    module = 'cogs.{}'.format(cog_name.lower())
                    owner_cog._load_cog(module)
                    set_cog(module, True)
                except Exception as e:
                    await self.bot.say(box("Loading cog failed: {}: {}".format(e.__class__.__name__, str(e))))
        await self.bot.say('Done!')
Ejemplo n.º 34
0
 async def _install(self, ctx, cog: str):
     """Installs specified cog"""
     install_cog = await self.install(cog)
     if install_cog:
         await self.bot.say("Installation completed. Load it now? (yes/no)")
         answer = await self.bot.wait_for_message(timeout=15, author=ctx.message.author)
         if answer is None:
             await self.bot.say("Ok then, you can load it with `{}load {}`".format(ctx.prefix, cog))
         elif answer.content.lower().strip() in ["yes", "y"]:
             set_cog("cogs." + cog, True)
             self.bot.unload_extension("cogs." + cog)
             self.bot.load_extension("cogs." + cog)
             await self.bot.say("Done.")
         else:
             await self.bot.say("Ok then, you can load it with `{}load {}`".format(ctx.prefix, cog))
     elif install_cog == False:
         await self.bot.say("Invalid cog. Installation aborted.")
     else:
         await self.bot.say("That cog doesn't exist. Use cog list to see the full list.")
Ejemplo n.º 35
0
 async def unload(self, *, cog_name: str):
     """Désactive un module"""
     module = cog_name.strip()
     if "cogs." not in module:
         module = "cogs." + module
     if not self._does_cogfile_exist(module):
         await self.bot.say("Le fichier 'cogs' n'existe pas. Ce n'est pas censé être possible...")
     else:
         set_cog(module, False)
     try:  # No matter what we should try to unload it
         self._unload_cog(module)
     except OwnerUnloadWithoutReloadError:
         await self.bot.say("Impossible de désactiver le module 'Owner' : j'ai besoin des fonctionnalités qui sont dedans !")
     except CogUnloadError as e:
         log.exception(e)
         traceback.print_exc()
         await self.bot.say('Impossible de désactiver ce module.')
     else:
         await self.bot.say("Le module a été désactvié.")
Ejemplo n.º 36
0
 async def unload_all(self):
     """Unloads all cogs"""
     cogs = self._list_cogs()
     still_loaded = []
     for cog in cogs:
         set_cog(cog, False)
         try:
             self._unload_cog(cog)
         except OwnerUnloadWithoutReloadError:
             pass
         except CogUnloadError as e:
             log.exception(e)
             traceback.print_exc()
             still_loaded.append(cog)
     if still_loaded:
         still_loaded = ", ".join(still_loaded)
         await self.bot.say("I was unable to unload some cogs: "
                            "{}".format(still_loaded))
     else:
         await self.bot.say("All cogs are now unloaded.")
Ejemplo n.º 37
0
 async def unload_all(self):
     """Décharge tous les modules"""
     cogs = self._list_cogs()
     still_loaded = []
     for cog in cogs:
         set_cog(cog, False)
         try:
             self._unload_cog(cog)
         except OwnerUnloadWithoutReloadError:
             pass
         except CogUnloadError as e:
             log.exception(e)
             traceback.print_exc()
             still_loaded.append(cog)
     if still_loaded:
         still_loaded = ", ".join(still_loaded)
         await self.bot.say("Ces modules n'ont pas été déchargés : "
             "{}".format(still_loaded))
     else:
         await self.bot.say("Tous les modules ont été déchargés.")
Ejemplo n.º 38
0
 async def unload_all(self):
     """Unloads all cogs"""
     cogs = self._list_cogs()
     still_loaded = []
     for cog in cogs:
         set_cog(cog, False)
         try:
             self._unload_cog(cog)
         except OwnerUnloadWithoutReloadError:
             pass
         except CogUnloadError as e:
             log.exception(e)
             traceback.print_exc()
             still_loaded.append(cog)
     if still_loaded:
         still_loaded = ", ".join(still_loaded)
         await self.bot.say("Je n'ai pas pu décharger les plugins:"
                            "{}".format(still_loaded))
     else:
         await self.bot.say("Tous les plugins sont maintenant déchargés.")
Ejemplo n.º 39
0
 async def unload_all(self):
     """Rozładowuje wszystkie moduły"""
     cogs = self._list_cogs()
     still_loaded = []
     for cog in cogs:
         set_cog(cog, False)
         try:
             self._unload_cog(cog)
         except OwnerUnloadWithoutReloadError:
             pass
         except CogUnloadError as e:
             log.exception(e)
             traceback.print_exc()
             still_loaded.append(cog)
     if still_loaded:
         still_loaded = ", ".join(still_loaded)
         await self.bot.say("Nie udało się rozładować kilku modułów: "
                            "{}".format(still_loaded))
     else:
         await self.bot.say("Wszystkie moduły rozładowane.")
Ejemplo n.º 40
0
 async def unload_all(self):
     """Unloads all modules"""
     cogs = self._list_cogs()
     still_loaded = []
     for cog in cogs:
         set_cog(cog, False)
         try:
             self._unload_cog(cog)
         except OwnerUnloadWithoutReloadError:
             pass
         except CogUnloadError as e:
             log.exception(e)
             traceback.print_exc()
             still_loaded.append(cog)
     if still_loaded:
         still_loaded = ", ".join(still_loaded)
         await self.bot.say("I was unable to unload some cogs: "
             "{}".format(still_loaded))
     else:
         await self.bot.say("All cogs are now unloaded.")
Ejemplo n.º 41
0
    async def unload(self, *, module: str):
        """Unloads a module

        Example: unload mod"""
        module = module.strip()
        if "cogs." not in module:
            module = "cogs." + module
        if not self._does_cogfile_exist(module):
            await self.bot.say("That module file doesn't exist. I will not"
                               " turn off autoloading at start just in case"
                               " this isn't supposed to happen.")
        else:
            set_cog(module, False)
        try:  # No matter what we should try to unload it
            self._unload_cog(module)
        except OwnerUnloadWithoutReloadError:
            await self.bot.say("I cannot allow you to unload the Owner plugin"
                               " unless you are in the process of reloading.")
        except CogUnloadError as e:
            log.exception(e)
            traceback.print_exc()
            await self.bot.say('Unable to safely disable that module.')
        else:
            await self.bot.say("Module disabled.")