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

[Bug] UserMessagesPronouns loading of pronouns #2967

Open
2 tasks done
Mylloon opened this issue Oct 23, 2024 · 3 comments
Open
2 tasks done

[Bug] UserMessagesPronouns loading of pronouns #2967

Mylloon opened this issue Oct 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Mylloon
Copy link
Contributor

Mylloon commented Oct 23, 2024

Discord Account

mylloon

What happens when the bug or crash occurs?

The pronouns are only loaded when clicking on the profile

What is the expected behaviour?

I expect pronouns to be loaded without the need of a click

How do you recreate this bug or crash?

  1. Conversation with a user you don't have in the cache
  2. No pronoun
  3. Click on user's profile
  4. Pronouns

Errors

No response

Request Agreement

  • I am using Discord Stable or tried on Stable and this bug happens there as well
  • I have read the requirements for opening an issue above
@Mylloon Mylloon added the bug Something isn't working label Oct 23, 2024
@Vendicated
Copy link
Owner

this is kinda difficult to do because pronouns are only available in the profile payload, which you can only fetch by opening someones profile

you have to fetch it individually for every user and the rate limit isn't very generous

thus, fetching everyone in chat is likely not viable

@Sqaaakoi
Copy link
Contributor

I've already dumped some thoughts about this days ago

I've just been trying this out today and I've found a few things that feel weird about the plugin
I wouldn't be surprised if these existed in the PronounDB plugin too

  1. The tooltip showing "Pronouns" feels off-center, because it includes the
  2. Pronouns are not cached by the plugin itself, so every time the client is restarted, pronouns do not show until the user profile is opened, defeating the point of the plugin

1 is trivial to solve, the second isn't so much. How do you propose solving that? Cache in DataStore every time it's rendered, if Discord can't provide pronouns then load from cache?

the only realistic way of solving this (excluding spamming the API) is making a cache in DataStore, which isn't hard to do

i'd suggest having each user in the cache expire after not being used for amount of time

outmaneuver added a commit to outmaneuver/Vencord that referenced this issue Oct 23, 2024
Fixes Vendicated#2967

Implement a caching mechanism for pronouns to load them without the need to click on the user's profile.

* **Caching Mechanism**:
  - Implement caching using `DataStore` in `src/plugins/userMessagesPronouns/utils.ts`.
  - Add functions to get, set, and fetch pronouns with caching.
  - Modify `useDiscordPronouns` to check the cache before fetching pronouns.
  - Export `fetchAndCachePronouns` function.

* **PronounsChatComponent**:
  - Update `PronounsChatComponent` in `src/plugins/userMessagesPronouns/PronounsChatComponent.tsx` to use cached pronouns if available.

* **Message Events**:
  - Add logic in `src/plugins/userMessagesPronouns/index.ts` to fetch and cache pronouns when a user sends a message.
  - Add export for `MessageEvents` in `src/api/MessageEvents.ts`.
@angrybirdice
Copy link

is vancord better than better discord?

Repository owner deleted a comment Jan 3, 2025
Repository owner deleted a comment Jan 3, 2025
Repository owner deleted a comment Jan 3, 2025
Repository owner locked as spam and limited conversation to collaborators Jan 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants