Skip to content
Advertisement

How to make bot Whent, the bot

I have this code but I have errors

client.on("message", (message) => {

Advertisement

Answer

You have few errors in code, first addField method takes 2 parameters, and both are type of string, setFooter also. client.users.get("404968772969955329").send(yumz) grabs user(visible by bot) with id 404968772969955329 and sends him a direct message, so if you want to send message direct to guild channel you’ll need something like this:

client.on("message", (message) => {
  if (message.channel.type === "dm") {
    if (message.author.id != client.user.id) {
      let yumz = new Discord.RichEmbed()
      .setTimestamp()
      .setTitle("Direct Message To The Bot")
      .addField("Sent By", message.author.username)
      .setColor("RANDOM")
      .setThumbnail(message.author.displayAvatarURL)
      .addField('Message:', message.content)
      .setFooter('DM Bot Messages | DM Logs')
      client.channels.find('id','404968772969955329').send(yumz) // channel id
    }       
  }
});
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement