admin管理员组文章数量:1289496
I'm making a bot on Discord.js. The bot will give a role to every user. The problem is I want the bot DM the role to each user. The code was just not working for me.
What I've tried:
client.users.get('id').send('Blabla')
, but it didn't work.
message.author.send("Blabla.")
would only send the message to the author.
message.channel.send("Blabla")
would only send the message to a channel.
I'm making a bot on Discord.js. The bot will give a role to every user. The problem is I want the bot DM the role to each user. The code was just not working for me.
What I've tried:
client.users.get('id').send('Blabla')
, but it didn't work.
message.author.send("Blabla.")
would only send the message to the author.
message.channel.send("Blabla")
would only send the message to a channel.
1 Answer
Reset to default 9client.users.get('id').send('Blabla')
did not work because in discord.js v12 you have to use the new cache system, in your case it's UserManager#cache
.
So your solution is: client.users.cache.get('id').send('Blabla')
本文标签: javascriptHow to DM user using discordjsStack Overflow
版权声明:本文标题:javascript - How to DM user using discord.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741454266a2379666.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论