Ejemplo n.º 1
0
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.")
Ejemplo n.º 2
0
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.")
Ejemplo n.º 3
0
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.")
Ejemplo n.º 4
0
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())))
Ejemplo n.º 5
0
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())))