Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

discord.js-commando TypeError: this.fetchUser is not a function

I recently coded a discord bot on my personal computer with nodejs and discord.js-commando it works just fine on windows, but I tried to put it on my raspberry pi 3b, I installed the lastest version of nodejs, I used scp to transfer the files tried to run the bot but it just gives me this error :

(node:2609) UnhandledPromiseRejectionWarning: TypeError: this.fetchUser is not a function
    at CommandoClient.<anonymous> (/home/pi/bot/node_modules/discord.js-commando/src/client.js:84:11)
    at Object.onceWrapper (events.js:417:28)
    at CommandoClient.emit (events.js:323:22)
    at WebSocketManager.triggerClientReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:433:17)
    at WebSocketManager.checkShardsReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:417:10)
    at WebSocketShard.<anonymous> (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:199:14)
    at WebSocketShard.emit (events.js:311:20)
    at WebSocketShard.checkReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:466:12)
    at WebSocketShard.onPacket (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:438:16)
    at WebSocketShard.onMessage (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
(node:2609) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2609) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I really think this has to do with the discord.js-commando package but I don't really know for sure.

like image 273
Hedip Avatar asked May 20 '26 08:05

Hedip


1 Answers

client.fetchUser() has been depreciated. Now its client.user.fetch(). This aplies to all of these commands like:

client.channels.fetch() // Excepted output: TextChannel { ... }
client.guilds.fetch() // Excepted output: Guild { ... }
message.guild.members.fetch() // Excepted output: GuildMember { ... }

And so more... More info here: Page has removed content :p

IMPORTANT NOTE: Make sure that "this" is an instance of client.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!