TypeError: this.dispatch is not a function
Hi Guys I use @discordjs/rest but when I try to do a request I always get:
My Code:
NPM Version:
NodeJS:
TypeError: this.dispatch is not a function
at String.request (/root/testApp/node_modules/undici/lib/api/api-request.js:193:10)
at /root/testApp/node_modules/undici/lib/api/api-request.js:186:15
at new Promise (<anonymous>)
at String.request (/root/testApp/node_modules/undici/lib/api/api-request.js:185:12)
at /root/testApp/node_modules/undici/index.js:83:15
at SequentialHandler.runRequest (/root/testApp/node_modules/@discordjs/rest/dist/index.js:531:46)
at SequentialHandler.queueRequest (/root/testApp/node_modules/@discordjs/rest/dist/index.js:464:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)TypeError: this.dispatch is not a function
at String.request (/root/testApp/node_modules/undici/lib/api/api-request.js:193:10)
at /root/testApp/node_modules/undici/lib/api/api-request.js:186:15
at new Promise (<anonymous>)
at String.request (/root/testApp/node_modules/undici/lib/api/api-request.js:185:12)
at /root/testApp/node_modules/undici/index.js:83:15
at SequentialHandler.runRequest (/root/testApp/node_modules/@discordjs/rest/dist/index.js:531:46)
at SequentialHandler.queueRequest (/root/testApp/node_modules/@discordjs/rest/dist/index.js:464:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)My Code:
rest
.get(Routes.user(this.applicationId))
.then(data => {
this.emit('debug', "[DEBUG] Got the client data from the API");
this.user = new User(data);
}).catch(e => {
this.emit('debug', "[DEBUG] Got a error by fetching the client data from the API!" + e);
console.log(e)
}); rest
.get(Routes.user(this.applicationId))
.then(data => {
this.emit('debug', "[DEBUG] Got the client data from the API");
this.user = new User(data);
}).catch(e => {
this.emit('debug', "[DEBUG] Got a error by fetching the client data from the API!" + e);
console.log(e)
});NPM Version:
@discordjs/rest@1.5.0@discordjs/rest@1.5.0NodeJS:
v18.12.0v18.12.0