Skip to content

Commit

Permalink
feat: support avatar decorations (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdanialraza authored May 15, 2024
1 parent 65eebd9 commit 7650ce4
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 4 deletions.
8 changes: 7 additions & 1 deletion deno/payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { PresenceUpdateReceiveStatus } from './gateway.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIAvatarDecorationData, APIUser } from './user.ts';

/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
Expand Down Expand Up @@ -668,6 +668,12 @@ export interface APIGuildMember {
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
/**
* The data for the member's guild avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down
24 changes: 24 additions & 0 deletions deno/payloads/v10/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ export interface APIUser {
* The user's avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*
* @deprecated Use `avatar_decoration_data` instead
*/
avatar_decoration?: string | null;
/**
* The data for the user's avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down Expand Up @@ -320,3 +328,19 @@ export interface APIApplicationRoleConnection {
*/
metadata: Record<string, number | string>;
}

/**
* https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
export interface APIAvatarDecorationData {
/**
* The avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
asset: string;
/**
* The id of the avatar decoration's SKU
*/
sku_id: Snowflake;
}
8 changes: 7 additions & 1 deletion deno/payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { PresenceUpdateReceiveStatus } from './gateway.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIAvatarDecorationData, APIUser } from './user.ts';

/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
Expand Down Expand Up @@ -660,6 +660,12 @@ export interface APIGuildMember {
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
/**
* The data for the member's guild avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down
24 changes: 24 additions & 0 deletions deno/payloads/v9/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ export interface APIUser {
* The user's avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*
* @deprecated Use `avatar_decoration_data` instead
*/
avatar_decoration?: string | null;
/**
* The data for the user's avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down Expand Up @@ -320,3 +328,19 @@ export interface APIApplicationRoleConnection {
*/
metadata: Record<string, number | string>;
}

/**
* https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
export interface APIAvatarDecorationData {
/**
* The avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
asset: string;
/**
* The id of the avatar decoration's SKU
*/
sku_id: Snowflake;
}
12 changes: 12 additions & 0 deletions deno/rest/v10/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,23 @@ export const CDNRoutes = {
* - GET `/avatar-decorations/{user.id}/{user.avatar_decoration}.png`
*
* This route supports the extension: PNG
*
* @deprecated Use {@link CDNRoutes.avatarDecoration} instead.
*/
userAvatarDecoration(userId: Snowflake, userAvatarDecoration: string) {
return `/avatar-decorations/${userId}/${userAvatarDecoration}.png` as const;
},

/**
* Route for:
* - GET `/avatar-decoration-presets/{avatar_decoration_data_asset}.png`
*
* This route supports the extension: PNG
*/
avatarDecoration(avatarDecorationDataAsset: string) {
return `/avatar-decoration-presets/${avatarDecorationDataAsset}.png` as const;
},

/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
Expand Down
12 changes: 12 additions & 0 deletions deno/rest/v9/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,11 +1110,23 @@ export const CDNRoutes = {
* - GET `/avatar-decorations/{user.id}/{user.avatar_decoration}.png`
*
* This route supports the extension: PNG
*
* @deprecated Use {@link CDNRoutes.avatarDecoration} instead.
*/
userAvatarDecoration(userId: Snowflake, userAvatarDecoration: string) {
return `/avatar-decorations/${userId}/${userAvatarDecoration}.png` as const;
},

/**
* Route for:
* - GET `/avatar-decoration-presets/{avatar_decoration_data_asset}.png`
*
* This route supports the extension: PNG
*/
avatarDecoration(avatarDecorationDataAsset: string) {
return `/avatar-decoration-presets/${avatarDecorationDataAsset}.png` as const;
},

/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
Expand Down
8 changes: 7 additions & 1 deletion payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { PresenceUpdateReceiveStatus } from './gateway';
import type { OAuth2Scopes } from './oauth2';
import type { APIRole } from './permissions';
import type { APISticker } from './sticker';
import type { APIUser } from './user';
import type { APIAvatarDecorationData, APIUser } from './user';

/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
Expand Down Expand Up @@ -668,6 +668,12 @@ export interface APIGuildMember {
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
/**
* The data for the member's guild avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down
24 changes: 24 additions & 0 deletions payloads/v10/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ export interface APIUser {
* The user's avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*
* @deprecated Use `avatar_decoration_data` instead
*/
avatar_decoration?: string | null;
/**
* The data for the user's avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down Expand Up @@ -320,3 +328,19 @@ export interface APIApplicationRoleConnection {
*/
metadata: Record<string, number | string>;
}

/**
* https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
export interface APIAvatarDecorationData {
/**
* The avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
asset: string;
/**
* The id of the avatar decoration's SKU
*/
sku_id: Snowflake;
}
8 changes: 7 additions & 1 deletion payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { PresenceUpdateReceiveStatus } from './gateway';
import type { OAuth2Scopes } from './oauth2';
import type { APIRole } from './permissions';
import type { APISticker } from './sticker';
import type { APIUser } from './user';
import type { APIAvatarDecorationData, APIUser } from './user';

/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
Expand Down Expand Up @@ -660,6 +660,12 @@ export interface APIGuildMember {
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
/**
* The data for the member's guild avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down
24 changes: 24 additions & 0 deletions payloads/v9/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ export interface APIUser {
* The user's avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*
* @deprecated Use `avatar_decoration_data` instead
*/
avatar_decoration?: string | null;
/**
* The data for the user's avatar decoration
*
* See https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
avatar_decoration_data?: APIAvatarDecorationData | null;
}

/**
Expand Down Expand Up @@ -320,3 +328,19 @@ export interface APIApplicationRoleConnection {
*/
metadata: Record<string, number | string>;
}

/**
* https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
*/
export interface APIAvatarDecorationData {
/**
* The avatar decoration hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
asset: string;
/**
* The id of the avatar decoration's SKU
*/
sku_id: Snowflake;
}
12 changes: 12 additions & 0 deletions rest/v10/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,23 @@ export const CDNRoutes = {
* - GET `/avatar-decorations/{user.id}/{user.avatar_decoration}.png`
*
* This route supports the extension: PNG
*
* @deprecated Use {@link CDNRoutes.avatarDecoration} instead.
*/
userAvatarDecoration(userId: Snowflake, userAvatarDecoration: string) {
return `/avatar-decorations/${userId}/${userAvatarDecoration}.png` as const;
},

/**
* Route for:
* - GET `/avatar-decoration-presets/{avatar_decoration_data_asset}.png`
*
* This route supports the extension: PNG
*/
avatarDecoration(avatarDecorationDataAsset: string) {
return `/avatar-decoration-presets/${avatarDecorationDataAsset}.png` as const;
},

/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
Expand Down
12 changes: 12 additions & 0 deletions rest/v9/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,11 +1110,23 @@ export const CDNRoutes = {
* - GET `/avatar-decorations/{user.id}/{user.avatar_decoration}.png`
*
* This route supports the extension: PNG
*
* @deprecated Use {@link CDNRoutes.avatarDecoration} instead.
*/
userAvatarDecoration(userId: Snowflake, userAvatarDecoration: string) {
return `/avatar-decorations/${userId}/${userAvatarDecoration}.png` as const;
},

/**
* Route for:
* - GET `/avatar-decoration-presets/{avatar_decoration_data_asset}.png`
*
* This route supports the extension: PNG
*/
avatarDecoration(avatarDecorationDataAsset: string) {
return `/avatar-decoration-presets/${avatarDecorationDataAsset}.png` as const;
},

/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
Expand Down

0 comments on commit 7650ce4

Please sign in to comment.