Unexpected token client

const client = new Discord.Client()
const axios = require("axios");
const Discord = require("discord.js");


module.exports = {
  name: "iplookup",
  description: "iplookup",
  async execute(msg, args, client, prefix)
 
client.login("");

Client.on('message', async message => {
    let args = message.content.split(" ");
      let bruh = args.slice(1).join(" ");  
  if(message.author.bot) return;
  if(message.content.toLowerCase().startsWith('$iplookup')) {
    const nashe = new Discord.MessageEmbed()
    .setTitle("ERROR")
    .setColor("RED")
    .setDescription("Manda una IP culiado")
   if(!bruh) return message.channel.send(nashe)

   let getIp = async () => {
       let response = await axios.get(`https://ip.teoh.io/api/{bruh}`);
       let ip = response.data
       return ip;
   };

   let ipValue = await getIp()

   const chupala = new Discord.MessageEmbed()
   .setTitle(`IP Data of **${bruh}**`)
   .setColor("GREEN")
   .setDescription(`IP: **${ipValue.query}** \n - Country: **${ipValue.country}** \n - Country Code: **${ipValue.countryCode}** \n - Region Name: **${ipValue.regionName}** \n - City: **${ipValue.city}** \n - Agency: **${ipValue.as}** \n - Lat: **${ipValue.lat}** \n - Lon: **${ipValue.lon}**`)
   .setFooter("Pete")
   .setTimestamp()
   message.channel.send(chupala);
  }
});

idk wtf im doing wrong, can someone help me? is a iplookup

client.login("");

its the red circle

You need a dollar sign here https://ip.teoh.io/api/${bruh}

1 Like

but still have the same error, image

Could be because there is not a semicolon ; on the line that defines client, other than that hopefully someone with more discord experience can help you.

Javascript automatically adds semicolons where they are needed when the code is run so therefore they don’t cause any issues if they are not there.

I didn’t know that, that article is a great read, although some of those edge cases feel like they’d be pretty common.

Ignoring the semicolon, my new theory for this error is that you used the discord.js library before requiring it. Perhaps revising the first three lines as follows will help:

const axios = require("axios");
const Discord = require("discord.js");
const client = new Discord.Client();

If that doesn’t work we’ll have proven yet again why I avoid JavaScript wherever possible :call_me_hand:

4 Likes

Discord.Client() isn’t defined. Put const Discord = require("discord.js"); at the top of your code

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.