Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticker.fetchUser() doesn't work | TypeError: this.client.users.add is not a function #6420

Closed
IvanGodinez21 opened this issue Aug 13, 2021 · 0 comments · Fixed by #6421
Closed

Comments

@IvanGodinez21
Copy link

Please describe the problem you are having in as much detail as possible:
Basically Sticker.fetchUser() isn't working, I used Sticker.fetch() and it worked

This is what I get when I run my code

Sticker {
  id: '859884354128838666',
  description: 'Un emoji bastante sorprendido',
  type: 'GUILD',
  format: 'PNG',
  name: 'WARNING-E ~ Gran sorpresa',
  packId: null,
  tags: [ 'flushed' ],
  available: true,
  guildId: '390200963476094976',
  user: null,
  sortValue: null
}
C:\Users\ivano\Repositorios\GitHubDesktop\EmojiPackager\node_modules\discord.js\src\structures\Sticker.js:81
    this.user = sticker.user ? this.client.users.add(sticker.user) : null;
                                                 ^

TypeError: this.client.users.add is not a function
    at Sticker._patch (C:\Users\ivano\Repositorios\GitHubDesktop\EmojiPackager\node_modules\discord.js\src\structures\Sticker.js:81:50)
    at Sticker.fetchUser (C:\Users\ivano\Repositorios\GitHubDesktop\EmojiPackager\node_modules\discord.js\src\structures\Sticker.js:162:10)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.module.exports.run (C:\Users\ivano\Repositorios\GitHubDesktop\EmojiPackager\src\apps\global\stickers.js:13:21)
    at async Client.<anonymous> (C:\Users\ivano\Repositorios\GitHubDesktop\EmojiPackager\src\events\interactionCreate.js:18:21)
[nodemon] app crashed - waiting for file changes before starting...

Include a reproducible code sample here, if possible:

module.exports.run = async (client, interaction) => {
  let message = await interaction.channel.messages.fetch(interaction.targetId); // meesage with sticker
  let stickers = Array.from(await message.stickers.values()); //stickers to array
  let stickerFiles = new Array();
  for (let i = 0; i <= stickers.length - 1; i++) {
      stickerFiles.push(stickers[i]);
      console.log(await stickers[i].fetch()) //works
      console.log(await stickers[i].fetchUser()) // doesn't works
  }
  interaction.reply({
      content: 'done'
  });
}

Further details:

  • discord.js version: v13.1.0
  • Node.js version: 16.6.1
  • Operating system: Windows 10 Home
  • Priority this issue should have – please be realistic and elaborate if possible: Low

Relevant client options:

  • partials: 'USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE', 'REACTION'
  • gateway intents: Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, Intents.FLAGS.GUILD_INTEGRATIONS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_WEBHOOKS
  • other: none
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants