示例#1
0
文件: builtin.py 项目: Jeglet/pcbot
async def reload(message: discord.Message, *names: str.lower):
    """ Reloads all plugins or the specified plugin. """
    if names:
        reloaded = []
        for name in names:
            if not plugins.get_plugin(name):
                await client.say(message, "`{}` is not a plugin.".format(name))
                continue

            # The plugin entered is valid so we reload it
            await plugins.save_plugin(name)
            await plugins.call_reload(name)
            reloaded.append(name)

        if reloaded:
            await client.say(message, "Reloaded plugin{} `{}`.".format(
                "s" if len(reloaded) > 1 else "", ", ".join(reloaded)))
    else:
        # Reload all plugins
        await plugins.save_plugins()

        for plugin_name in plugins.all_keys():
            await plugins.call_reload(plugin_name)

        await client.say(message, "All plugins reloaded.")
示例#2
0
文件: builtin.py 项目: PcBoy111/PCBOT
async def reload(message: discord.Message, *names: str.lower):
    """ Reloads all plugins or the specified plugin. """
    if names:
        reloaded = []
        for name in names:
            if not plugins.get_plugin(name):
                await client.say(message, "`{}` is not a plugin.".format(name))
                continue

            # The plugin entered is valid so we reload it
            await plugins.save_plugin(name)
            plugins.reload_plugin(name)
            reloaded.append(name)

        if reloaded:
            await client.say(message, "Reloaded plugin{} `{}`.".format(
                "s" if len(reloaded) > 1 else "", ", ".join(reloaded)))
    else:
        # Reload all plugins
        await plugins.save_plugins()

        for plugin_name in plugins.all_keys():
            plugins.reload_plugin(plugin_name)

        await client.say(message, "All plugins reloaded.")
示例#3
0
文件: builtin.py 项目: xZwop/PCBOT
def reload(client: discord.Client, message: discord.Message, name: str.lower=None):
    """ Reloads all plugins or the specified plugin. """
    if name:
        assert plugins.get_plugin(name), "`{}` is not a plugin".format(name)

        # The plugin entered is valid so we reload it
        yield from plugins.save_plugin(name)
        plugins.reload_plugin(name)
        yield from client.say(message, "Reloaded plugin `{}`.".format(name))
    else:
        # Reload all plugins
        yield from plugins.save_plugins()

        for plugin_name in plugins.all_keys():
            plugins.reload_plugin(plugin_name)

        yield from client.say(message, "All plugins reloaded.")
示例#4
0
文件: builtin.py 项目: Jeglet/pcbot
async def plugin_(message: discord.Message):
    """ Manage plugins.
        **Owner command unless no argument is specified.**
        """
    await client.say(message, "**Plugins:** ```{}```".format(", ".join(plugins.all_keys())))
示例#5
0
文件: builtin.py 项目: xZwop/PCBOT
def plugin_(client: discord.Client, message: discord.Message):
    """ Manage plugins.
        **Owner command unless no argument is specified.** """
    yield from client.say(message,
                          "**Plugins:** ```{}```".format(", ".join(plugins.all_keys())))