1

I've been trying to make a Discord.JS Highlight command which basically when a specified word is said it DMS you saying that word was said. I'm trying to make it work for multiple servers I've tried as much as I can and it's not working any help would be appreciated

if (command === "highlight") {
  if (!message.member.hasPermission("ADMINISTRATOR")) {
    let color = message.member.displayHexColor;
    if (!color) color = "RANDOM";
    const a = new Discord.MessageEmbed()
      .setTitle(`Uh oh ${message.author.tag}`)
      .setDescription(`Your missing perms you need "Administrator"`)
      .setColor(color);
    return message.channel.send(b);
  }

  if (!args[0]) {
    let color = message.member.displayHexColor;
    if (!color) color = "RANDOM";
    const b = new Discord.MessageEmbed()
      .setTitle(`${message.author.tag}`)
      .setDescription(`Say your wanted highlight`)
      .setColor(color);
    return message.channel.send(b);
  }

  db.add(`bl_${message.guild.id}`, args[0]);
  db.add(`ms_${message.guild.id}`, message.author.id);
  let color = message.member.displayHexColor;
  if (!color) color = "RANDOM";
  const c = new Discord.MessageEmbed()
    .setTitle("Succesfully added")
    .setColor(color);
  message.channel.send(c);
}

client.on("message", async message => {
  let blacklisted = db.get(`bl_${message.guild.id}`);
  let ms = db.get(`ms_${message.guild.id}`);
  if (blacklisted === null) return;

  var ma = `${message.author}`;
  let ee = new Discord.MessageEmbed()
    .setTitle(`Someone said ${message.content}`)
    .setURL(message.url)
    .addField("Message Author", `${ma}`);

  let foundInText = false;
  for (var i in blacklisted) {
    if (message.content.toLowerCase().includes(blacklisted[i].toLowerCase()))
      foundInText = true;
  }
  if (foundInText) {
    client.users.cache.get(ms).send(ee);
  }
});
Gh05d
  • 7,923
  • 7
  • 33
  • 64
LinusDropTips
  • 71
  • 1
  • 1
  • 4
  • Shouldn't it be `client.users.cache.get(ma).send(ee);` as `ma` is the author you want to message and `ms` is the message? – Gh05d Mar 18 '21 at 09:33

0 Answers0