New error Please help


#1

Error:
UnhandledPromiseRejectionWarning: TypeError: this.fetchUser is not a function

MyCode:
const { CommandoClient } = require(‘discord.js-commando’);
const path = require(‘path’);

const client = new CommandoClient({
commandPrefix: ‘’,
unknownCommandResponse: false,
owner: ‘’,
disableEveryone: true
});
client.on(‘ready’, () => {
console.log(‘Logged in!’);
client.user.setActivity(‘game’);
});
client.registry
.registerDefaultTypes()
.registerGroups([
[‘grp1’, ‘Our First Command Group’]
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, ‘commands’));

client.login(process.env.TOKEN);


commands/grp1/kaptan.js :

const { Command } = require(‘discord.js-commando’);

module.exports = class ReplyCommand extends Command {
constructor(client) {
super(client, {
name: ‘reply’,
group: ‘grp1’,
memberName: ‘reply’,
description: ‘Replies with a Message.’,
examples: [‘reply’]
});
}

run(msg) {
  msg.say('Hi, I\'m awake!');
}

};


#2

Hey @BlankSans can you post the entire error message you’re seeing? I can’t tell from what you’ve posted where fetchUser() is being accessed from.

Or post your project name and we can take a closer look.


#3

project name : bottavuk

Error:

(node:504) UnhandledPromiseRejectionWarning: TypeError: this.fetchUser is not a function

12:13 AM

at CommandoClient.once (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.registry.npmjs.org/discord.js-commando/0.10.0/node_modules/discord.js-commando/src/client.js:84:11)

12:13 AM

at Object.onceWrapper (events.js:313:30)

12:13 AM

at emitNone (events.js:111:20)

12:13 AM

at CommandoClient.emit (events.js:208:7)

12:13 AM

at WebSocketManager.triggerReady (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.github.com/discordjs/discord.js/b5d5c699e65bf14a77065a75aabd24e4972988a9/node_modules/discord.js/src/client/websocket/WebSocketManager.js:253:17)

12:13 AM

at WebSocketManager.checkReady (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.github.com/discordjs/discord.js/b5d5c699e65bf14a77065a75aabd24e4972988a9/node_modules/discord.js/src/client/websocket/WebSocketManager.js:224:61)

12:13 AM

at Object.module.exports [as GUILD_CREATE] (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.github.com/discordjs/discord.js/b5d5c699e65bf14a77065a75aabd24e4972988a9/node_modules/discord.js/src/client/websocket/handlers/GUILD_CREATE.js:11:17)

12:13 AM

at WebSocketManager.handlePacket (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.github.com/discordjs/discord.js/b5d5c699e65bf14a77065a75aabd24e4972988a9/node_modules/discord.js/src/client/websocket/WebSocketManager.js:201:31)

12:13 AM

at WebSocketShard.onPacket (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.github.com/discordjs/discord.js/b5d5c699e65bf14a77065a75aabd24e4972988a9/node_modules/discord.js/src/client/websocket/WebSocketShard.js:259:29)

12:13 AM

at WebSocketShard.onMessage (/rbd/pnpm-volume/58e5ca18-71e6-4777-91bb-9bcc72c12ef7/node_modules/.github.com/discordjs/discord.js/b5d5c699e65bf14a77065a75aabd24e4972988a9/node_modules/discord.js/src/client/websocket/WebSocketShard.js:310:10)

12:13 AM

(node:504) 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(). (rejection id: 1)

12:13 AM

(node:504) [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.

12:13 AM