所以我试图发出一个ROSTER命令。该命令为$roster add/remove @user RANK
。该命令基本上应该编辑上一个机器人的消息(花名册),并在命令中将用户添加到花名册中的RANK ...这是我到目前为止的代码,但是我还没有设法制作花名册消息和编辑部分它和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.`)
}
}})
答案 0 :(得分:0)
您想要的是类似.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);