【发布时间】:2019-06-29 15:39:49
【问题描述】:
我的 Discord 机器人通过 discord.py 运行,使用 on_message 函数。如何创建关闭命令和重启 Bot 的命令?
我的机器人在 repl.it 上托管的服务器上运行。
代码:
if message.content.upper().startswith("!SHUTDOWN"):
if "534116283487223809" in [role.id for role in message.author.roles]:
await client.send_message(message.channel, "*Shutting Down...*")
time.sleep(0.5)
#SCRIPT TO SHUT DOWN HERE
理想情况下,命令应该响应"!shutdown" 和"!restart",并且只能由我使用。
【问题讨论】:
标签: python discord discord.py repl.it