builtin.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:pcbot 作者: pckv 项目源码 文件源码
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.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号