Estoy creando un bot de discordia y quiero hacer esto: alguien escribe -ping y el bot responde con @theuserwhotyped-ping .
No tengo errores, simplemente no sé cómo codificarlo, y no encuentro ninguna solución en Internet.
Aquí está el código que hice:
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 } });Puedes usar message.reply :
message.reply('typed ping'); Envía una respuesta, como @peter, typed ping .
O use el message.author :
message.channel.send(`${message.author} typed ping`); Envía un mensaje como @peter typed ping .