【发布时间】:2021-05-11 11:27:45
【问题描述】:
我正在制作一个不和谐的机器人,我想做这个:有人输入-ping,机器人回复@theuserwhotyped-ping。
我没有错误,就是不知道怎么编码,网上也没找到解决办法。
这是我制作的代码:
const Discord = require("discord.js");
const client = new Discord.Client();
const prefix = "-";
client.on("message", message=>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(" ");
const command = args.shift().toLowerCase();
if (command === "ping"){
message.channel.send("@{user}); //this is the line which dont work
}
});
【问题讨论】:
标签: javascript node.js discord.js