Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
Discord.js v12: Error: The class/prototype returned from the extender function must extend the existing structure class/prototype

I am trying to set up a event handler for my bot. After I add the code and start the bot it outputs the error: Error:

Error: The class/prototype returned from the extender function must extend the existing structure class/prototype (received function ExtendedTextChannel extends TextChannel; expected extension of ExtendedTextChannel).
    at Function.extend (/home/runner/ricebot/node_modules/discord.js/src/util/Structures.js:82:13)
    at module.exports (/home/runner/ricebot/node_modules/discord-buttons/src/index.js:24:16)
    at Object.<anonymous> (/home/runner/ricebot/index.js:35:27)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/ricebot/events/ready.js:1:16)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at /home/runner/ricebot/index.js:119:18

Code:

readdirSync("./events/").forEach((file) => {
  const events = readdirSync("./events/").filter((file) =>
    file.endsWith(".js")
  );

  for(let file of events) {
    let pull = require(`./events/${file}`);

    if(pull.name) {
      client.events.set(pull.name, pull);
    } else {
      continue;
    }
  }
});

The error log leads me to this line 35 require('discord-buttons')(client); and to this line 119 let pull = require(`./events/${file}`)

This really seems confusing to me. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!