Q:

Getting unexpected token when running my code that is supposed to post gifs from giphy

Im getting a unexpected token, but I'm not sure what I'm doing wrong.
I tried to delete all modules and then renstall them but that didnt help
import { Client } from 'discord.js';
const client = new Client();

var GphApiClient = require('giphy-js-sdk-core')
client = GphApiClient("MyAPIkey");

client.once('ready', () => {
  console.log('Ready!');
});

client.on('message', message => {
   if (message.content.startsWith(`${prefix}!send`)) {
        giphy.search('gifs', {"q": "cats"})
        .then((response) => {
        var totalResponses = response.data.length;
        var responseIndex = Math.floor((Math.random() * 10) + 1) % 
        totalResponses;
        var responseFinal = response.data[responseIndex];

        message.channel.send("Kapo on teel", {
            files: [responseFinal.images.fixed_height.url]
        })

    })
  };
})

This is the error I was getting:
SyntaxError: Unexpected token {
  at Module._compile (internal/modules/cjs/loader.js:811:22)

A:

I think your syntax error is because you were trying to use ES6 modules (eg: import/export) without using something to transpile (eg: babel). There's more on that here if you're interested. In other words, I don't think you can use import. You have to use require. I also fixed the issues with client being defined multiple times. However, this code below still won't work because prefix was never defined anywhere.
const { Client } = require('discord.js');
var GphApiClient = require('giphy-js-sdk-core')

const discordClient = new Client();
giphyClient = GphApiClient('MyAPIkey');

discordClient.once('ready', () => {
  console.log('Ready!');
});

discordClient.on('message', message => {
  if (message.content.startsWith(`${prefix}!send`)) {
    giphyClient.search('gifs', { "q": "cats" })
      .then((response) => {
        const totalResponses = response.data.length;
        const responseIndex = Math.floor((Math.random() * 10) + 1) % totalResponses;
        const responseFinal = response.data[responseIndex];

        message.channel.send("Kapo on teel", {
          files: [responseFinal.images.fixed_height.url]
        });

      })
  } else {
    console.log(`message doesn't start with ${prefix}!send`)
  }
});

