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

t.users.last is not a function #35

Closed
Androz2091 opened this issue Feb 14, 2020 · 3 comments
Closed

t.users.last is not a function #35

Androz2091 opened this issue Feb 14, 2020 · 3 comments

Comments

@Androz2091
Copy link
Contributor

Here is my code:

const { lastPosts } = await this.client.insta.getProfile(this.client.config.insta);
const lastPostShortCode = lastPosts[0].shortcode;
const lastPost = await this.client.insta.getPost(lastPostShortCode);
const embeds = [];

lastPost.contents.forEach((item) => {
    const embed = new Discord.MessageEmbed()
    .setImage(item.url);
    embeds.push(embed);
});

let pagination = new Pagination.Embeds()
.setArray(embeds)
.setAuthorizedUsers([message.author.id])
.setChannel(message.channel)
.setPageIndicator(true)
.setColor("#FF0000")
.setTitle("Ouvrir sur Instagram")
.setURL(lastPosts[0].link)
.addField("❤️ Likes", lastPost.likes)
.addField("💬 Commentaires", lastPosts[0].comments);

pagination.build();

The embeds var contains an Array of MessageEmbeds. When I react, all the reactions are removed without error.

I added a console.log(t); at the top of the _cleanUp function, and now I'm getting this error:

TypeError: t.users.last is not a function
    at exports.Embeds._awaitResponse (/Users/simon/Documents/GitHub/cyanide-happiness-bot/node_modules/discord-paginationembed/bin/base/index.js:163:32)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Capture d’écran 2020-02-14 à 10 36 38

@gazmull
Copy link
Owner

gazmull commented Feb 14, 2020

Deployed fix for the error. Please reinstall with npm i discord-paginationembed@beta!


Since it was caught by the internal function, the error got emitted through error event (PaginationEmbed extends EventEmitter). I advise listening to the event to recognise the cause of the problem right away. Thanks for reporting!

@gazmull gazmull closed this as completed Feb 14, 2020
@Jovin-Ang
Copy link

I am still running into this issue with the latest version

TypeError: Cannot read property 'last' of undefined
    at exports.Embeds._awaitResponse (/rbd/pnpm-volume/62876d80-160e-479c-88ac-d013b13a516d/node_modules/.registry.npmjs.org/discord-paginationembed/2.0.0-beta.4/node_modules/discord-paginationembed/bin/base/index.js:163:38)
    at process._tickCallback (internal/process/next_tick.js:68:7)

@Jovin-Ang Jovin-Ang mentioned this issue Feb 20, 2020
@Androz2091
Copy link
Contributor Author

Hmm... It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants