TypeError: bot.fetchUser is not a function

So I was upading a unban command and I get a error TypeError: bot.fetchUser is not a function

Here is the code

run: async (bot, message, args) => {

    if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send(":x: You dont have permission to perform this command!")


	if(isNaN(args[0])) return message.channel.send(":x: You need to provide an ID.")
    let bannedMember = await bot.fetchUser(args[0])
        if(!bannedMember) return message.channel.send(":x: Please provide a user id to unban someone!")

    let reason = args.slice(1).join(" ")
        if(!reason) reason = "No reason given!"

    if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send(":x: I dont have permission to perform this command!")|
    message.delete()
    try {
        message.guild.members.unban(bannedMember, reason)
        message.channel.send(`:white_check_mark: ${bannedMember.tag} has been unbanned from the guild!`)
    } catch(e) {
        console.log(e.message)
    }

    }
}

I dont know what to change bot.fetchUser to since the discord.js V12 update.

Fetch

Some methods that retrieve uncached data have been changed, transformed in the shape of a Manager.

- client.fetchUser('123456789012345678');
+ client.users.fetch('123456789012345678');

- guild.fetchMember('123456789012345678');
+ guild.members.fetch('123456789012345678');

- guild.fetchMembers();
+ guild.members.fetch();

- textChannel.fetchMessage('123456789012345678');
+ textChannel.messages.fetch('123456789012345678');

- textChannel.fetchMessages({ limit: 10 });
+ textChannel.messages.fetch({ limit: 10 });

- textChannel.fetchPinnedMessages();
+ textChannel.messages.fetchPinned();
1 Like