本文整理汇总了Python中discord.Client.save_plugins方法的典型用法代码示例。如果您正苦于以下问题:Python Client.save_plugins方法的具体用法?Python Client.save_plugins怎么用?Python Client.save_plugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类discord.Client
的用法示例。
在下文中一共展示了Client.save_plugins方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cmd_plugin
# 需要导入模块: from discord import Client [as 别名]
# 或者: from discord.Client import save_plugins [as 别名]
def cmd_plugin(client: discord.Client, message: discord.Message,
option: str, plugin_name: str.lower="") -> cmd_plugin_noargs:
""" Manage plugins. """
if option == "reload":
if plugin_name:
if plugin_name in client.plugins:
yield from client.save_plugin(plugin_name)
client.reload_plugin(plugin_name)
m = "Reloaded plugin `{}`.".format(plugin_name)
else:
m = "`{}` is not a plugin. See `!plugin`.".format(plugin_name)
else:
yield from client.save_plugins()
for plugin in client.plugins.keys():
client.reload_plugin(plugin)
m = "All plugins reloaded."
elif option == "load":
if plugin_name:
if plugin_name not in client.plugins:
loaded = client.load_plugin(plugin_name)
if loaded:
m = "Plugin `{}` loaded.".format(plugin_name)
else:
m = "Plugin `{}` could not be loaded.".format(plugin_name)
else:
m = "Plugin `{}` is already loaded.".format(plugin_name)
else:
m = "You need to specify the name of the plugin to load."
elif option == "unload":
if plugin_name:
if plugin_name in client.plugins:
yield from client.save_plugin(plugin_name)
client.unload_plugin(plugin_name)
m = "Plugin `{}` unloaded.".format(plugin_name)
else:
m = "`{}` is not a plugin. See `!plugin`.".format(plugin_name)
else:
m = "You need to specify the name of the plugin to unload."
else:
m = "`{}` is not a valid option.".format(option)
yield from client.send_message(message.channel, m)
示例2: cmd_stop
# 需要导入模块: from discord import Client [as 别名]
# 或者: from discord.Client import save_plugins [as 别名]
def cmd_stop(client: discord.Client, message: discord.Message):
""" """
yield from client.send_message(message.channel, ":boom: :gun:")
yield from client.save_plugins()
yield from client.logout()