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

feat: super reactions #9336

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

jaw0r3k
Copy link
Contributor

@jaw0r3k jaw0r3k commented Apr 7, 2023

Please describe the changes this PR makes and why it should be merged:

Status and versioning classification:

  • Code changes have been tested against the Discord API
  • I know how to update typings and have done so
  • This PR changes the library's interface (methods or parameters added)

@vercel
Copy link

vercel bot commented Apr 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Mar 16, 2024 1:12pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Mar 16, 2024 1:12pm

@vercel
Copy link

vercel bot commented Apr 7, 2023

@jaw0r3k is attempting to deploy a commit to the discordjs Team on Vercel.

A member of the Team first needs to authorize it.

@Jiralite Jiralite removed the blocked label Feb 21, 2024
@Jiralite Jiralite marked this pull request as ready for review February 21, 2024 08:32
@Jiralite Jiralite requested a review from a team as a code owner February 21, 2024 08:32
@Jiralite
Copy link
Member

Looks like to properly implement this, we need to discord/discord-api-docs#6375 so we can discern the kind of reaction we receive from the gateway to manually update the counts:

const reaction = message.reactions._add({
emoji: data.emoji,
count: message.partial ? null : 0,
me: user.id === this.client.user.id,
});
if (!reaction) return false;
reaction._add(user);

_add(user) {
if (this.partial) return;
this.users.cache.set(user.id, user);
if (!this.me || user.id !== this.message.client.user.id || this.count === 0) this.count++;
this.me ||= user.id === this.message.client.user.id;
}
_remove(user) {
if (this.partial) return;
this.users.cache.delete(user.id);
if (!this.me || user.id !== this.message.client.user.id) this.count--;
if (user.id === this.message.client.user.id) this.me = false;
if (this.count <= 0 && this.users.cache.size === 0) {
this.message.reactions.cache.delete(this.emoji.id ?? this.emoji.name);
}
}

@Jiralite Jiralite marked this pull request as draft February 21, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review in Progress
Development

Successfully merging this pull request may close these issues.

None yet

2 participants