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

New usernames system #221

Merged
merged 5 commits into from
Jul 5, 2023
Merged

New usernames system #221

merged 5 commits into from
Jul 5, 2023

Conversation

Dakurei
Copy link
Contributor

@Dakurei Dakurei commented May 24, 2023

Summary

I added the new 'global_name' field that would be interesting to have for bots, as well as modified 2-3 mechanics of some methods to keep some kind of consistency with what Discord is displaying since this transition period with the new usernames.

I didn't touch anything concerning the updating of this field from the bot, I only did the reading.

I voluntarily left some TODOs lying around since I'm not sure of anything about the direction the API modification is going to take, and I had to search in the github of their docs (discord/discord-api-docs#6130) since the deployed one is still not up to date concerning this new system...

I also tried to get rid of the dependency on the 0000 discriminator to determine if a user is a webhook

And I added a missing flag while I was at it.


Added

  • Add global_name attribute to User
  • Add User#display_name
  • Add User#webhook_account (with aliases: webhook_account? & webhook?)
  • Add ACTIVE_DEVELOPER flag

Changed

  • Change User#distinct to use discriminator or not, depend to the context
  • Change Discordrb::API::User#default_avatar & User#avatar_url to use old method to calculate index or not, depend to legacy or not (Depending on whether the account has already migrated to the new username)
  • Change Member#display_name to select global_name before username, but after server nickname
  • Change Webhook#avatar_url to use new method to calculate index (After testing the webhook creation, the ID already seems to be used for the default avatar instead of the discriminator at 0000)
  • Change Message#initialize & User#initialize to add a way to know if the user is a webhook without relying on the discriminator
  • Changes to take into account global_name modification in Discordrb's cache

Removed

  • Remove Message::ZERO_DISCRIM which is no longer used

Dakurei added 5 commits June 28, 2023 21:48
  + Add User#display_name
  + Change User#distinct to use discriminator or not, depend to the context (Maybe need change method later, next API versions may remove the discriminator field)
  + Change Discordrb::API::User#default_avatar & User#avatar_url to use old method to calculate index or not, depend to legacy or not (Maybe need change method later, next API versions may remove the discriminator field)
  + Change Member#display_name to select global_name before username, but after server nickname
  + Change Webhook#avatar_url to use new method to calculate index (After testing the webhook creation, the ID already seems to be used for the default avatar instead of the discriminator at 0000)
  + Without relying on a 0000 discrimator, since it is very likely that this field will disappear completely, sooner or later
  + As I saw that the 'ACTIVE_DEVELOPER' flag was missing in the documentation, I added it in the process.
@tarragon
Copy link

tarragon commented Jul 2, 2023

Any chance this can go in soon?

@swarley swarley merged commit 9ca8ebe into shardlab:main Jul 5, 2023
@Dakurei Dakurei deleted the new_usernames branch July 5, 2023 17:45
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

Successfully merging this pull request may close these issues.

3 participants