Skip to content

Commit

Permalink
feat(discord): add missing global_name field (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaysDragon authored Jul 16, 2024
1 parent 5e34920 commit 4a1f487
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion adapters/discord/src/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface User {
username: string
/** the user's 4-digit discord-tag */
discriminator: string
/** the user's display name, if it is set. For bots, this is the application name */
global_name?: string
/** the user's avatar hash */
avatar?: string
/** whether the user belongs to an OAuth2 application */
Expand Down Expand Up @@ -106,7 +108,7 @@ export enum VisibilityType {
EVERYONE = 1,
}

export interface UserUpdateEvent extends User {}
export interface UserUpdateEvent extends User { }

declare module './gateway' {
interface GatewayEvents {
Expand Down
1 change: 1 addition & 0 deletions adapters/discord/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const sanitizeCode = (val: string) => val.replace(/(?<=`)(?=`)/g, '\u200b

export const decodeUser = (user: Discord.User): Universal.User => ({
id: user.id,
nick: user.global_name,
name: user.username,
userId: user.id,
avatar: user.avatar && `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png`,
Expand Down

0 comments on commit 4a1f487

Please sign in to comment.