【发布时间】:2021-12-04 17:30:30
【问题描述】:
我看到许多开发人员使用两种方式为 Discord 编写 Python 机器人。
其中一些使用:
if message.content.startswith("command"):
await message.channel.send("text")
和其他人(大多数)使用这种方法:
@client.command()
async def command(ctx):
response = "Text"
await ctx.send(response)
这两者之间有什么区别,使用哪种方法更好/更有效率?
【问题讨论】:
-
我见过使用第一个的指南和使用后者的指南,我认为第二个是一种更“pythonic”的方式来做同样的事情