@@ -342,15 +342,32 @@ class Client extends BaseClient {
342
342
return new Sticker ( this , data ) ;
343
343
}
344
344
345
+ /**
346
+ * Options for fetching sticker packs.
347
+ * @typedef {Object } StickerPackFetchOptions
348
+ * @property {Snowflake } [packId] The id of the sticker pack to fetch
349
+ */
350
+
345
351
/**
346
352
* Obtains the list of available sticker packs.
347
- * @returns {Promise<Collection<Snowflake, StickerPack>> }
353
+ * @param {StickerPackFetchOptions } [options={}] Options for fetching sticker packs
354
+ * @returns {Promise<Collection<Snowflake, StickerPack>|StickerPack> }
355
+ * A collection of sticker packs, or a single sticker pack if a packId was provided
348
356
* @example
349
357
* client.fetchStickerPacks()
350
358
* .then(packs => console.log(`Available sticker packs are: ${packs.map(pack => pack.name).join(', ')}`))
351
359
* .catch(console.error);
360
+ * @example
361
+ * client.fetchStickerPacks({ packId: '751604115435421716' })
362
+ * .then(pack => console.log(`Sticker pack name: ${pack.name}`))
363
+ * .catch(console.error);
352
364
*/
353
- async fetchStickerPacks ( ) {
365
+ async fetchStickerPacks ( { packId } = { } ) {
366
+ if ( packId ) {
367
+ const data = await this . rest . get ( Routes . stickerPack ( packId ) ) ;
368
+ return new StickerPack ( this , data ) ;
369
+ }
370
+
354
371
const data = await this . rest . get ( Routes . stickerPacks ( ) ) ;
355
372
return new Collection ( data . sticker_packs . map ( stickerPack => [ stickerPack . id , new StickerPack ( this , stickerPack ) ] ) ) ;
356
373
}
0 commit comments