所以我正在尝试制作一个 ROSTER 命令。命令是$roster add/remove @user RANK。该命令基本上应该编辑以前的机器人的消息(名册)并将用户添加到名册中的命令中的排名...这是我到目前为止的代码,但我还没有设法制作名册消息和编辑部分它和排名系统。如果有人可以提供帮助,那就太棒了!
//ROOSTER COMMAND
client.on('message', async message => {
if (message.content.startsWith(prefix + "roster")) {
if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('You do not have that permission! :x:').then(message.react(':x:'))
const args = message.content.slice(prefix.length + 7).split(/ +/)
let uReply = args[0];
const user = message.mentions.members.first()
if(!uReply) message.channel.send("Please use `add` or `remove`.")
if(uReply === 'add') {
if(!user) return message.channel.send("Please make sure to provide which user you would like to add...")
message.channel.send(`you are adding **${user.displayName}** from the roster.`)
} else if(uReply === 'remove') {
if(!user) return message.channel.send("Please make sure to provide which user you would like to add...")
message.channel.send(`you are removing **${user.displayName}** from the roster.`)
}
}})
Run Code Online (Sandbox Code Playgroud)
听起来这个.edit()方法就是你想要的。
文档中的示例:
// Update the content of a message
message.edit('This is my new content!')
.then(msg => console.log(`Updated the content of a message to ${msg.content}`))
.catch(console.error);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25464 次 |
| 最近记录: |