DCE*_*521 2 python-3.x discord discord.py
我有以下基本的 python 不和谐机器人代码:
@bot.command()
async def replyTest(ctx):
await ctx.send('Reply to this message')
def check(m):
return m
msg = await bot.wait_for("message", check=check)
print(msg)
Run Code Online (Sandbox Code Playgroud)
有没有办法m只在m回复类型消息时返回?
您只需检查该消息是否有引用即可。
def check(m):
if m.reference is not None and not m.is_system:
return True
return False
Run Code Online (Sandbox Code Playgroud)
此外,如果您想检查引用是否指向消息:
def check(m):
if m.reference is not None:
if m.reference.message_id == some_msg.id:
return True
return False
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6446 次 |
| 最近记录: |