diff --git a/adapters/discord/src/types/user.ts b/adapters/discord/src/types/user.ts index 85c3431f..b5ed4838 100644 --- a/adapters/discord/src/types/user.ts +++ b/adapters/discord/src/types/user.ts @@ -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 */ @@ -106,7 +108,7 @@ export enum VisibilityType { EVERYONE = 1, } -export interface UserUpdateEvent extends User {} +export interface UserUpdateEvent extends User { } declare module './gateway' { interface GatewayEvents { diff --git a/adapters/discord/src/utils.ts b/adapters/discord/src/utils.ts index a6f970c9..1619f973 100644 --- a/adapters/discord/src/utils.ts +++ b/adapters/discord/src/utils.ts @@ -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`,