python - 当我提到某个人时,我是否可以通过discord.py 让我的机器人通过私信联系他们?

标签 python discord discord.py

更具体地说,我希望在使用我的命令前缀以及我分配给它的任何命令后,告诉机器人向我提到的用户发送消息。

最佳答案

是的。如果您使用the commands extension ,您可以使用 MemberConverterUserConverter获取MemberUser分别为对象。否则,您可以使用 Message.mentions Message 的属性对象来获取消息中提到的Member列表。然后,您可以使用Member.send/User.send DM 方法。

关于python - 当我提到某个人时,我是否可以通过discord.py 让我的机器人通过私信联系他们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59871013/

相关文章:

python - 使用 ruamel.yaml 安全转储和加载 defaultdict

javascript - Discord.js V13 : How to edit Message Object of Interaction?

python - 运行时警告 : coroutine was never awaited self. _target(*self._args, **self._kwargs)

python - Discord 机器人如何加入 Discord Rewrite 中的语音 channel ?

python - 带前缀和非前缀的命令不能在 python discord bot 上一起工作

python - 运行时错误 : PyNaCl library needed in order to use voice

python - Pygame 不会导入到 python

包内的 Python 依赖项

python - 获取属性错误: module 'mod_commands' has no attribute 'ban' - even though I added it

python - 使用 scipy 查找样条曲线的平滑度