Skip to content

Fetching Users

nutmeg edited this page Feb 22, 2023 · 6 revisions

Run Down

Fetching users is taking an id or a mention (@user or <@id>) and returning the user's info
If the user does not exist it returns null

Fetching Cache Users

Cache user fetching is called with PSClient.fetchUser() and it uses the bot's user cache to return the user's info

let user = PSClient.fetchUser(user);

Fetching Guild Users

Guild user fetching is called with PSClient.fetchGuildUser() and it uses the guild to return the user's info
It also has an optional guild value if you wish to use it and it defaults to ctx.guild

let user = await PSClient.fetchGuildUser(user);

// or for guild

let user = await PSClient.fetchGuildUser(user, guild);

Fetch User Related Functions

PSClient.fetchUser

  • Description: Fetches the info for a user using the bot's cache
  • Setup: PSClient.fetchUser(user)
  • Aliases: fetchMember
  • Returns: User

PSClient.fetchGuildUser

  • Description: Fetches the info for a user using the guild
  • Setup: await PSClient.fetchGuildUser(user, ?guild)
  • Aliases: fetchGuildMember
  • Returns: Guild User

Clone this wiki locally