DM用户执行命令

时间:2019-02-27 14:29:34

标签: discord.py

好吧,所以我要制造一个机器人,当用户运行命令+invite时,我希望它向邀请服务器的用户发送DM。我将使用什么代码来做到这一点?

1 个答案:

答案 0 :(得分:0)

如果您使用异步分支,则应使用:

send_message(destination, content)

https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.send_message

要将消息作为DM发送,您的目的地将是原始消息的作者,因此可以使用message.channel代替message.author

相关问题