【发布时间】:2020-09-08 02:32:56
【问题描述】:
我正在用 Python 制作一个 Discord 机器人,我想创建一个只有我可以使用的命令。这是我尝试过的示例代码,但没有成功:
#replace MY_USER_ID with user ID number.
if message.content.startswith('$hello'):
if message.author == "<@MY_USER_ID>":
await message.channel.send('Hello creator!')
else:
await message.channel.send('Hello!')
使用 Python 3.8.5 和 discord.py 1.4.1。
【问题讨论】:
标签: python python-3.x discord discord.py