MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / createStickerSet

Method createStickerSet

sticker/sticker.ts:403–444  ·  view source on GitHub ↗
(
    client: TelegramClient,
    me: Api.User,
    packName: string,
    stickerInfo: { isAnimated: boolean; isVideo: boolean; isStatic: boolean; emoji: string, document: Api.InputDocument }
  )

Source from the content-addressed store, hash-verified

401 client: TelegramClient,
402 me: Api.User,
403 packName: string,
404 stickerInfo: { isAnimated: boolean; isVideo: boolean; isStatic: boolean; emoji: string, document: Api.InputDocument }
405 ): Promise<void> {
406 let title = `@${me.username} 的收藏`;
407 if (stickerInfo.isAnimated) title += " (动态)";
408 else if (stickerInfo.isVideo) title += " (视频)";
409 else if (stickerInfo.isStatic) title += " (静态)";
410
411 try {
412 await client.invoke(new Api.stickers.CreateStickerSet({
413 userId: "me",
414 title: title,
415 shortName: packName,
416 stickers: [new Api.InputStickerSetItem({
417 document: stickerInfo.document,
418 emoji: stickerInfo.emoji,
419 })],
420 }));
421 } catch (error: any) {
422 let friendlyMessage = `创建贴纸包失败: ${error.message}`;
423 if (error.errorMessage) {
424 switch (error.errorMessage) {
425 case 'STICKER_VIDEO_LONG':
426 friendlyMessage = '视频贴纸时长不能超过3秒。';
427 break;
428 case 'STICKER_PNG_DIMENSIONS':
429 friendlyMessage = '静态贴纸尺寸必须为 512xN 或 Nx512 (一边为512px)。';
430 break;
431 case 'STICKERSET_INVALID':
432 friendlyMessage = '贴纸包名称无效或已被占用 (只能用字母、数字、下划线,且以字母开头)。';
433 break;
434 case 'PEER_ID_INVALID':
435 friendlyMessage = '无法与 @Stickers 机器人通信,请先私聊它一次。';
436 break;
437 }
438 }
439 throw new StickerError(friendlyMessage);
440 }
441 }
442
443 private async addToStickerSet(
444 client: TelegramClient,
445 stickerMsg: Api.Message,
446 packName: string,
447 emoji: string

Callers 1

handleStickerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected