So with my code it keeps showing an error and I have tried everything to solve it but nothing prevails.



SyntaxError: Unexpected end of input


const Discord = require("discord.js")
const fetch = require("node-fetch")
const client = new Discord.Client()

function Funkounter() {
  return fetch("")
  .then(res => {
    return res.json()
  .then(data => {
    return [0] ["q"] + " -" + data[0] ["a"]

client.on("ready", () => { 
  console.log(`logged in as  $ 

client.on("message", msg => {
  if ( return
  if (msg.content === "fb!spawn"){
   Funkounter().then(quote =>


An unexpected end of input means (usually) the Javascript engine hit the end of your code… And the the code came to a bad end. Usually something was opened, and not closed.

Count how many opening curly braces you have… And how many closing curly braces you have.

The previous response likely is the cause for your error, but also wondering if:

Should be:

return data[0][“q”]


^ I would think so.

As said, check your brackets…did you forget to close something? I would suggest you throw your code into an editor like VS Code. It should give you a hint by marking part of the code as unreachable (dimmed out).

1 Like

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