Skip to content

Commit 0e8b9d4

Browse files
authored
🤖 Merge PR DefinitelyTyped#62633 Sticker changes and new functionality by @toniop99
* Complete Sticker interface * Add new fields to StickerSet and remove contains_mask * Add functions related with stickers * fix style * Delete empy interfaces for the moment * fix add required parameter
1 parent e99e901 commit 0e8b9d4

File tree

2 files changed

+85
-5
lines changed

2 files changed

+85
-5
lines changed

types/node-telegram-bot-api/index.d.ts

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,41 @@ declare namespace TelegramBot {
789789
can_pin_messages?: boolean | undefined;
790790
}
791791

792-
interface Sticker {
793-
file_id: string;
794-
file_unique_id: string;
792+
type StickerType = 'regular' | 'mask' | 'custom_emoji';
793+
794+
interface Sticker extends FileBase {
795+
type: StickerType;
795796
is_animated: boolean;
797+
is_video: boolean;
796798
width: number;
797799
height: number;
798800
thumb?: PhotoSize | undefined;
799801
emoji?: string | undefined;
800802
set_name?: string | undefined;
803+
premium_animation?: File | undefined;
801804
mask_position?: MaskPosition | undefined;
802-
file_size?: number | undefined;
805+
custom_emoji_id?: string | undefined;
803806
}
804807

805808
interface StickerSet {
806809
name: string;
807810
title: string;
808-
contains_masks: boolean;
811+
sticker_type: StickerType;
812+
is_animated: boolean;
813+
is_video: boolean;
809814
stickers: Sticker[];
815+
thumb?: PhotoSize | undefined;
816+
}
817+
818+
interface CreateStickerSetOptions {
819+
tgs_sticker?: string | Stream | Buffer;
820+
webm_sticker?: string | Stream | Buffer;
821+
sticker_type?: 'regular' | 'mask';
822+
mask_position?: MaskPosition;
823+
}
824+
825+
interface AddStickerToSetOptions {
826+
mask_position?: MaskPosition;
810827
}
811828

812829
interface MaskPosition {
@@ -1387,6 +1404,61 @@ declare class TelegramBot extends EventEmitter {
13871404
fileOptions?: TelegramBot.FileOptions,
13881405
): Promise<TelegramBot.Message>;
13891406

1407+
getStickerSet(
1408+
name: string,
1409+
options?: {},
1410+
): Promise<TelegramBot.StickerSet>;
1411+
1412+
getCustomEmojiStickers(
1413+
customEmojiIds: string[],
1414+
options?: {},
1415+
): Promise<TelegramBot.Sticker[]>;
1416+
1417+
uploadStickerFile(
1418+
userId: string,
1419+
pngSticker: string | Stream | Buffer,
1420+
options?: {},
1421+
fileOptions?: TelegramBot.FileOptions,
1422+
): Promise<TelegramBot.File>;
1423+
1424+
createNewStickerSet(
1425+
userId: string,
1426+
name: string,
1427+
title: string,
1428+
pngSticker: string | Stream | Buffer,
1429+
emojis: string,
1430+
options?: TelegramBot.CreateStickerSetOptions,
1431+
fileOptions?: TelegramBot.FileOptions,
1432+
): Promise<boolean>;
1433+
1434+
addStickerToSet(
1435+
userId: string,
1436+
name: string,
1437+
sticker: string | Stream | Buffer,
1438+
emojis: string,
1439+
stickerType: 'png_sticker' | 'tgs_sticker' | 'webm_sticker',
1440+
options?: TelegramBot.AddStickerToSetOptions,
1441+
fileOptions?: TelegramBot.FileOptions,
1442+
): Promise<boolean>;
1443+
1444+
setStickerPositionInSet(
1445+
sticker: string,
1446+
position: number,
1447+
): Promise<boolean>;
1448+
1449+
deleteStickerFromSet(
1450+
sticker: string,
1451+
options?: {},
1452+
): Promise<boolean>;
1453+
1454+
setStickerSetThumb(
1455+
userId: string,
1456+
name: string,
1457+
pngThumb: string | Stream | Buffer,
1458+
options?: {},
1459+
fileOptions?: TelegramBot.FileOptions,
1460+
): Promise<boolean>;
1461+
13901462
sendVideo(
13911463
chatId: TelegramBot.ChatId,
13921464
video: string | Stream | Buffer,

types/node-telegram-bot-api/node-telegram-bot-api-tests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,11 @@ MyTelegramBot.setMyDefaultAdministratorRights({
350350
});
351351
MyTelegramBot.getMyDefaultAdministratorRights({});
352352
MyTelegramBot.answerWebAppQuery('query_id', res);
353+
MyTelegramBot.getStickerSet('custom-set-name');
354+
MyTelegramBot.getCustomEmojiStickers(['123', '986']);
355+
MyTelegramBot.uploadStickerFile('user_id', 'my_png_sticker_file');
356+
MyTelegramBot.createNewStickerSet('user_id', 'short_name', 'my sticker set name', 'my_png_sticker_file', 'hello');
357+
MyTelegramBot.addStickerToSet('user_id', 'custom_sticker', 'sticker_path', 'emoji', 'png_sticker');
358+
MyTelegramBot.setStickerPositionInSet('sticker_on_position_one', 2);
359+
MyTelegramBot.deleteStickerFromSet('sticker_on_position_one');
360+
MyTelegramBot.setStickerSetThumb('user_id', 'my_set_thumb', 'thumb_file');

0 commit comments

Comments
 (0)