Exemple #1
0
    def reload(self, mess, args):
        """reload a plugin"""
        args = args.strip()
        if not args:
            yield ("Please tell me which of the following plugin to reload:\n"
                   "{}".format(holder.bot.formatted_plugin_list(active_only=False)))
            return
        if args not in get_all_plugin_names():
            yield ("{} isn't a valid plugin names. The current plugin are:\n"
                   "{}".format(args, holder.bot.formatted_plugin_list(active_only=False)))
            return

        yield holder.bot.deactivate_plugin(args)  # Not needed but keeps the feedback to user consistent
        reload_plugin_by_name(args)
        yield holder.bot.activate_plugin(args)
Exemple #2
0
    def load(self, mess, args):
        """load a plugin"""
        args = args.strip()
        if not args:
            return ("Please tell me which of the following plugin to reload:\n"
                    "{}".format(holder.bot.formatted_plugin_list(active_only=False)))
        if args not in get_all_plugin_names():
            return ("{} isn't a valid plugin names. The current plugin are:\n"
                    "{}".format(args, holder.bot.formatted_plugin_list(active_only=False)))
        if args in get_all_active_plugin_names():
            return "{} is already loaded".format(args)

        reload_plugin_by_name(args)
        r = holder.bot.activate_plugin(args)
        return r