It'*_*lem 3 javascript bots node.js discord discord.io
我正在编写一个 Discord 机器人,它使用以下代码来检测和处理用户消息:
bot.on('message', function (user, userID, channelID, message, evt) {
//Message handling and response code goes here
});
Run Code Online (Sandbox Code Playgroud)
我想添加一个只有在发送它的用户具有管理员权限时才有效的命令。有没有办法做到这一点?
Gil*_*sch 10
以下是如何执行此操作的示例:
bot.on('message', function (user, userID, channelID, message, evt) {
if (message.member.hasPermission("ADMINISTRATOR")) return console.log('THIS USER HAS ADMINISTRATOR PERMISSIONS!')
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9920 次 |
| 最近记录: |