#code help

1 messages · Page 1 of 1 (latest)

fossil prism
unique vortex
#

Bruh why did you make a thread

fossil prism
#

client.on("messageCreate", msg => {
  
  if(msg.author.bot)
  return

  else {

    if(msg.channel.type != "DM"){
    
      if (msg.content === dm_prefix + " " + "ping") {
        msg.reply("pong");
      }
  
    }

    else {

    if (msg.content == dm_prefix + " " + "help") {
      const exampleEmbed = new MessageEmbed()
      .setTitle('DM help')
      .addField(':desktop: Server Suggestions', `${dm_prefix} suggest`, false)
      .addField(':robot: Bot Suggestions', `${dm_prefix} improve`, false)
      .addField(':grey_question: Anonymous Question', `${dm_prefix} ask`, false)
      
      msg.channel.send({ embeds: [exampleEmbed] });
    }

    else if(msg.content.startsWith(`${dm_prefix} suggest`)){
      (await msg.client.channels.fetch(channel_id)).send(msg.content)
    }

    else {
      msg.author.send(`The DM prefix is -> \`${dm_prefix}\` \nTry typing \`${dm_prefix} help\` `)
    }

    }
  
  }


})
fossil prism
vale gull
#

ur doing await in an non-async

fossil prism
#

how do i do it without await

vale gull
#

by removing await

fossil prism
# vale gull by removing await
      msg.client.channels.fetch(channel_id).send(msg.content)
                                            ^

TypeError: msg.client.channels.fetch(...).send is not a function
vale gull
#

try client.channels.cache.get(channel_id)

fossil prism
#

thanks

vale gull
#

ok