@mtcute/core 0.13.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/cjs/highlevel/base.d.ts +5 -2
  2. package/cjs/highlevel/base.js +9 -0
  3. package/cjs/highlevel/base.js.map +1 -1
  4. package/cjs/highlevel/client.d.ts +54 -6
  5. package/cjs/highlevel/client.js +16 -0
  6. package/cjs/highlevel/client.js.map +1 -1
  7. package/cjs/highlevel/client.types.d.ts +5 -1
  8. package/cjs/highlevel/client.types.js.map +1 -1
  9. package/cjs/highlevel/methods/_imports.js.map +1 -1
  10. package/cjs/highlevel/methods/_init.js +6 -0
  11. package/cjs/highlevel/methods/_init.js.map +1 -1
  12. package/cjs/highlevel/methods/auth/resend-code.d.ts +2 -0
  13. package/cjs/highlevel/methods/auth/resend-code.js +2 -2
  14. package/cjs/highlevel/methods/auth/resend-code.js.map +1 -1
  15. package/cjs/highlevel/methods/auth/send-code.d.ts +2 -0
  16. package/cjs/highlevel/methods/auth/send-code.js +1 -1
  17. package/cjs/highlevel/methods/auth/send-code.js.map +1 -1
  18. package/cjs/highlevel/methods/auth/sign-in-qr.d.ts +28 -0
  19. package/cjs/highlevel/methods/auth/sign-in-qr.js +125 -0
  20. package/cjs/highlevel/methods/auth/sign-in-qr.js.map +1 -0
  21. package/cjs/highlevel/methods/auth/sign-in.d.ts +2 -0
  22. package/cjs/highlevel/methods/auth/sign-in.js +2 -2
  23. package/cjs/highlevel/methods/auth/sign-in.js.map +1 -1
  24. package/cjs/highlevel/methods/auth/start.d.ts +10 -0
  25. package/cjs/highlevel/methods/auth/start.js +25 -3
  26. package/cjs/highlevel/methods/auth/start.js.map +1 -1
  27. package/cjs/highlevel/methods/chats/delete-history.d.ts +2 -4
  28. package/cjs/highlevel/methods/chats/delete-history.js.map +1 -1
  29. package/cjs/highlevel/methods/chats/kick-chat-member.js +1 -1
  30. package/cjs/highlevel/methods/chats/kick-chat-member.js.map +1 -1
  31. package/cjs/highlevel/methods/files/normalize-input-media.js +14 -0
  32. package/cjs/highlevel/methods/files/normalize-input-media.js.map +1 -1
  33. package/cjs/highlevel/methods/files/upload-media.js +1 -0
  34. package/cjs/highlevel/methods/files/upload-media.js.map +1 -1
  35. package/cjs/highlevel/methods/messages/find-in-update.js +4 -2
  36. package/cjs/highlevel/methods/messages/find-in-update.js.map +1 -1
  37. package/cjs/highlevel/methods/messages/send-media.js +5 -2
  38. package/cjs/highlevel/methods/messages/send-media.js.map +1 -1
  39. package/cjs/highlevel/methods.d.ts +1 -0
  40. package/cjs/highlevel/methods.js +8 -6
  41. package/cjs/highlevel/methods.js.map +1 -1
  42. package/cjs/highlevel/types/media/extended-media.d.ts +20 -0
  43. package/cjs/highlevel/types/media/extended-media.js +41 -0
  44. package/cjs/highlevel/types/media/extended-media.js.map +1 -0
  45. package/cjs/highlevel/types/media/index.d.ts +2 -0
  46. package/cjs/highlevel/types/media/index.js +2 -0
  47. package/cjs/highlevel/types/media/index.js.map +1 -1
  48. package/cjs/highlevel/types/media/input-media/factories.d.ts +2 -1
  49. package/cjs/highlevel/types/media/input-media/factories.js +7 -1
  50. package/cjs/highlevel/types/media/input-media/factories.js.map +1 -1
  51. package/cjs/highlevel/types/media/input-media/types.d.ts +12 -1
  52. package/cjs/highlevel/types/media/input-media/types.js.map +1 -1
  53. package/cjs/highlevel/types/media/invoice.d.ts +2 -20
  54. package/cjs/highlevel/types/media/invoice.js +3 -37
  55. package/cjs/highlevel/types/media/invoice.js.map +1 -1
  56. package/cjs/highlevel/types/media/paid-media.d.ts +33 -0
  57. package/cjs/highlevel/types/media/paid-media.js +66 -0
  58. package/cjs/highlevel/types/media/paid-media.js.map +1 -0
  59. package/cjs/highlevel/types/messages/message-media.d.ts +2 -1
  60. package/cjs/highlevel/types/messages/message-media.js +10 -0
  61. package/cjs/highlevel/types/messages/message-media.js.map +1 -1
  62. package/cjs/highlevel/types/stories/interactive/index.d.ts +3 -2
  63. package/cjs/highlevel/types/stories/interactive/index.js +5 -1
  64. package/cjs/highlevel/types/stories/interactive/index.js.map +1 -1
  65. package/cjs/highlevel/types/stories/interactive/input.d.ts +1 -0
  66. package/cjs/highlevel/types/stories/interactive/input.js +7 -0
  67. package/cjs/highlevel/types/stories/interactive/input.js.map +1 -1
  68. package/cjs/highlevel/types/stories/interactive/url.d.ts +11 -0
  69. package/cjs/highlevel/types/stories/interactive/url.js +20 -0
  70. package/cjs/highlevel/types/stories/interactive/url.js.map +1 -0
  71. package/cjs/highlevel/types/updates/callback-query.d.ts +16 -2
  72. package/cjs/highlevel/types/updates/callback-query.js +31 -1
  73. package/cjs/highlevel/types/updates/callback-query.js.map +1 -1
  74. package/cjs/highlevel/types/updates/index.d.ts +5 -2
  75. package/cjs/highlevel/types/updates/index.js +2 -1
  76. package/cjs/highlevel/types/updates/index.js.map +1 -1
  77. package/cjs/highlevel/types/updates/parse-update.js +2 -0
  78. package/cjs/highlevel/types/updates/parse-update.js.map +1 -1
  79. package/cjs/highlevel/updates/manager.d.ts +1 -0
  80. package/cjs/highlevel/updates/manager.js +3 -0
  81. package/cjs/highlevel/updates/manager.js.map +1 -1
  82. package/cjs/highlevel/worker/port.d.ts +11 -8
  83. package/cjs/highlevel/worker/port.js +10 -0
  84. package/cjs/highlevel/worker/port.js.map +1 -1
  85. package/cjs/highlevel/worker/protocol.d.ts +2 -0
  86. package/cjs/highlevel/worker/protocol.js.map +1 -1
  87. package/cjs/highlevel/worker/worker.js +1 -0
  88. package/cjs/highlevel/worker/worker.js.map +1 -1
  89. package/cjs/network/client.d.ts +2 -0
  90. package/cjs/network/client.js +8 -0
  91. package/cjs/network/client.js.map +1 -1
  92. package/cjs/network/mtproto-session.js +2 -0
  93. package/cjs/network/mtproto-session.js.map +1 -1
  94. package/cjs/network/network-manager.d.ts +9 -2
  95. package/cjs/network/network-manager.js +34 -15
  96. package/cjs/network/network-manager.js.map +1 -1
  97. package/cjs/network/session-connection.js +12 -3
  98. package/cjs/network/session-connection.js.map +1 -1
  99. package/cjs/storage/sqlite/repository/peers.d.ts +2 -0
  100. package/cjs/storage/sqlite/repository/peers.js +14 -0
  101. package/cjs/storage/sqlite/repository/peers.js.map +1 -1
  102. package/cjs/utils/bigint-utils.js +1 -1
  103. package/cjs/utils/bigint-utils.js.map +1 -1
  104. package/cjs/utils/misc-utils.d.ts +1 -0
  105. package/cjs/utils/misc-utils.js +17 -1
  106. package/cjs/utils/misc-utils.js.map +1 -1
  107. package/esm/highlevel/base.d.ts +5 -2
  108. package/esm/highlevel/base.js +9 -0
  109. package/esm/highlevel/base.js.map +1 -1
  110. package/esm/highlevel/client.d.ts +54 -6
  111. package/esm/highlevel/client.js +16 -0
  112. package/esm/highlevel/client.js.map +1 -1
  113. package/esm/highlevel/client.types.d.ts +5 -1
  114. package/esm/highlevel/client.types.js.map +1 -1
  115. package/esm/highlevel/methods/_imports.js.map +1 -1
  116. package/esm/highlevel/methods/_init.js +6 -0
  117. package/esm/highlevel/methods/_init.js.map +1 -1
  118. package/esm/highlevel/methods/auth/resend-code.d.ts +2 -0
  119. package/esm/highlevel/methods/auth/resend-code.js +2 -2
  120. package/esm/highlevel/methods/auth/resend-code.js.map +1 -1
  121. package/esm/highlevel/methods/auth/send-code.d.ts +2 -0
  122. package/esm/highlevel/methods/auth/send-code.js +1 -1
  123. package/esm/highlevel/methods/auth/send-code.js.map +1 -1
  124. package/esm/highlevel/methods/auth/sign-in-qr.d.ts +28 -0
  125. package/esm/highlevel/methods/auth/sign-in-qr.js +121 -0
  126. package/esm/highlevel/methods/auth/sign-in-qr.js.map +1 -0
  127. package/esm/highlevel/methods/auth/sign-in.d.ts +2 -0
  128. package/esm/highlevel/methods/auth/sign-in.js +2 -2
  129. package/esm/highlevel/methods/auth/sign-in.js.map +1 -1
  130. package/esm/highlevel/methods/auth/start.d.ts +10 -0
  131. package/esm/highlevel/methods/auth/start.js +25 -3
  132. package/esm/highlevel/methods/auth/start.js.map +1 -1
  133. package/esm/highlevel/methods/chats/delete-history.d.ts +2 -4
  134. package/esm/highlevel/methods/chats/delete-history.js.map +1 -1
  135. package/esm/highlevel/methods/chats/kick-chat-member.js +2 -2
  136. package/esm/highlevel/methods/chats/kick-chat-member.js.map +1 -1
  137. package/esm/highlevel/methods/files/normalize-input-media.js +14 -0
  138. package/esm/highlevel/methods/files/normalize-input-media.js.map +1 -1
  139. package/esm/highlevel/methods/files/upload-media.js +1 -0
  140. package/esm/highlevel/methods/files/upload-media.js.map +1 -1
  141. package/esm/highlevel/methods/messages/find-in-update.js +4 -2
  142. package/esm/highlevel/methods/messages/find-in-update.js.map +1 -1
  143. package/esm/highlevel/methods/messages/send-media.js +5 -2
  144. package/esm/highlevel/methods/messages/send-media.js.map +1 -1
  145. package/esm/highlevel/methods.d.ts +1 -0
  146. package/esm/highlevel/methods.js +1 -0
  147. package/esm/highlevel/methods.js.map +1 -1
  148. package/esm/highlevel/types/media/extended-media.d.ts +20 -0
  149. package/esm/highlevel/types/media/extended-media.js +38 -0
  150. package/esm/highlevel/types/media/extended-media.js.map +1 -0
  151. package/esm/highlevel/types/media/index.d.ts +2 -0
  152. package/esm/highlevel/types/media/index.js +2 -0
  153. package/esm/highlevel/types/media/index.js.map +1 -1
  154. package/esm/highlevel/types/media/input-media/factories.d.ts +2 -1
  155. package/esm/highlevel/types/media/input-media/factories.js +5 -0
  156. package/esm/highlevel/types/media/input-media/factories.js.map +1 -1
  157. package/esm/highlevel/types/media/input-media/types.d.ts +12 -1
  158. package/esm/highlevel/types/media/input-media/types.js.map +1 -1
  159. package/esm/highlevel/types/media/invoice.d.ts +2 -20
  160. package/esm/highlevel/types/media/invoice.js +2 -36
  161. package/esm/highlevel/types/media/invoice.js.map +1 -1
  162. package/esm/highlevel/types/media/paid-media.d.ts +33 -0
  163. package/esm/highlevel/types/media/paid-media.js +63 -0
  164. package/esm/highlevel/types/media/paid-media.js.map +1 -0
  165. package/esm/highlevel/types/messages/message-media.d.ts +2 -1
  166. package/esm/highlevel/types/messages/message-media.js +10 -0
  167. package/esm/highlevel/types/messages/message-media.js.map +1 -1
  168. package/esm/highlevel/types/stories/interactive/index.d.ts +3 -2
  169. package/esm/highlevel/types/stories/interactive/index.js +4 -1
  170. package/esm/highlevel/types/stories/interactive/index.js.map +1 -1
  171. package/esm/highlevel/types/stories/interactive/input.d.ts +1 -0
  172. package/esm/highlevel/types/stories/interactive/input.js +7 -0
  173. package/esm/highlevel/types/stories/interactive/input.js.map +1 -1
  174. package/esm/highlevel/types/stories/interactive/url.d.ts +11 -0
  175. package/esm/highlevel/types/stories/interactive/url.js +16 -0
  176. package/esm/highlevel/types/stories/interactive/url.js.map +1 -0
  177. package/esm/highlevel/types/updates/callback-query.d.ts +16 -2
  178. package/esm/highlevel/types/updates/callback-query.js +30 -0
  179. package/esm/highlevel/types/updates/callback-query.js.map +1 -1
  180. package/esm/highlevel/types/updates/index.d.ts +5 -2
  181. package/esm/highlevel/types/updates/index.js +2 -2
  182. package/esm/highlevel/types/updates/index.js.map +1 -1
  183. package/esm/highlevel/types/updates/parse-update.js +3 -1
  184. package/esm/highlevel/types/updates/parse-update.js.map +1 -1
  185. package/esm/highlevel/updates/manager.d.ts +1 -0
  186. package/esm/highlevel/updates/manager.js +3 -0
  187. package/esm/highlevel/updates/manager.js.map +1 -1
  188. package/esm/highlevel/worker/port.d.ts +11 -8
  189. package/esm/highlevel/worker/port.js +10 -0
  190. package/esm/highlevel/worker/port.js.map +1 -1
  191. package/esm/highlevel/worker/protocol.d.ts +2 -0
  192. package/esm/highlevel/worker/protocol.js.map +1 -1
  193. package/esm/highlevel/worker/worker.js +1 -0
  194. package/esm/highlevel/worker/worker.js.map +1 -1
  195. package/esm/network/client.d.ts +2 -0
  196. package/esm/network/client.js +8 -0
  197. package/esm/network/client.js.map +1 -1
  198. package/esm/network/mtproto-session.js +2 -0
  199. package/esm/network/mtproto-session.js.map +1 -1
  200. package/esm/network/network-manager.d.ts +9 -2
  201. package/esm/network/network-manager.js +35 -16
  202. package/esm/network/network-manager.js.map +1 -1
  203. package/esm/network/session-connection.js +12 -3
  204. package/esm/network/session-connection.js.map +1 -1
  205. package/esm/storage/sqlite/repository/peers.d.ts +2 -0
  206. package/esm/storage/sqlite/repository/peers.js +14 -0
  207. package/esm/storage/sqlite/repository/peers.js.map +1 -1
  208. package/esm/utils/bigint-utils.js +1 -1
  209. package/esm/utils/bigint-utils.js.map +1 -1
  210. package/esm/utils/misc-utils.d.ts +1 -0
  211. package/esm/utils/misc-utils.js +15 -0
  212. package/esm/utils/misc-utils.js.map +1 -1
  213. package/package.json +10 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extended-media.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/media/extended-media.ts"],"names":[],"mappings":";;;AAEA,+DAA4D;AAC5D,uDAAuD;AACvD,iDAA0C;AAE1C,MAAa,oBAAoB;IACD;IAA5B,YAA4B,GAAsC;QAAtC,QAAG,GAAH,GAAG,CAAmC;IAAG,CAAC;IAEtE;;OAEG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI,SAAS;QACT,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,IAAI,CAAA;QACf,CAAC;QAED,OAAO,IAAI,wBAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClD,CAAC;IAED;;;OAGG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,CAAA;IACtC,CAAC;CACJ;AAhCD,oDAgCC;AAED,IAAA,2BAAc,EAAC,oBAAoB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;AACnD,IAAA,gCAAe,EAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { makeInspectable } from '../../utils/inspectable.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { Thumbnail } from './thumbnail.js'\n\nexport class ExtendedMediaPreview {\n constructor(public readonly raw: tl.RawMessageExtendedMediaPreview) {}\n\n /**\n * Width of the preview, in pixels (if available, else 0)\n */\n get width(): number {\n return this.raw.w ?? 0\n }\n\n /**\n * Height of the preview, in pixels (if available, else 0)\n */\n get height(): number {\n return this.raw.h ?? 0\n }\n\n get thumbnail(): Thumbnail | null {\n if (!this.raw.thumb) {\n return null\n }\n\n return new Thumbnail(this.raw, this.raw.thumb)\n }\n\n /**\n * If this is a video, the duration of the video,\n * in seconds (if available, else 0)\n */\n get videoDuration(): number {\n return this.raw.videoDuration ?? 0\n }\n}\n\nmemoizeGetters(ExtendedMediaPreview, ['thumbnail'])\nmakeInspectable(ExtendedMediaPreview)\n"]}
@@ -2,10 +2,12 @@ export * from './audio.js';
2
2
  export * from './contact.js';
3
3
  export * from './dice.js';
4
4
  export * from './document.js';
5
+ export * from './extended-media.js';
5
6
  export * from './game.js';
6
7
  export * from './input-media/index.js';
7
8
  export * from './invoice.js';
8
9
  export * from './location.js';
10
+ export * from './paid-media.js';
9
11
  export * from './photo.js';
10
12
  export * from './poll.js';
11
13
  export * from './sticker.js';
@@ -18,10 +18,12 @@ __exportStar(require("./audio.js"), exports);
18
18
  __exportStar(require("./contact.js"), exports);
19
19
  __exportStar(require("./dice.js"), exports);
20
20
  __exportStar(require("./document.js"), exports);
21
+ __exportStar(require("./extended-media.js"), exports);
21
22
  __exportStar(require("./game.js"), exports);
22
23
  __exportStar(require("./input-media/index.js"), exports);
23
24
  __exportStar(require("./invoice.js"), exports);
24
25
  __exportStar(require("./location.js"), exports);
26
+ __exportStar(require("./paid-media.js"), exports);
25
27
  __exportStar(require("./photo.js"), exports);
26
28
  __exportStar(require("./poll.js"), exports);
27
29
  __exportStar(require("./sticker.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/media/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,+CAA4B;AAC5B,4CAAyB;AACzB,gDAA6B;AAC7B,4CAAyB;AACzB,yDAAsC;AACtC,+CAA4B;AAC5B,gDAA6B;AAC7B,6CAA0B;AAC1B,4CAAyB;AACzB,+CAA4B;AAC5B,6CAA0B;AAC1B,iDAA8B;AAC9B,6CAA0B;AAC1B,6CAA0B;AAC1B,6CAA0B;AAC1B,gDAA6B","sourcesContent":["export * from './audio.js'\nexport * from './contact.js'\nexport * from './dice.js'\nexport * from './document.js'\nexport * from './game.js'\nexport * from './input-media/index.js'\nexport * from './invoice.js'\nexport * from './location.js'\nexport * from './photo.js'\nexport * from './poll.js'\nexport * from './sticker.js'\nexport * from './story.js'\nexport * from './thumbnail.js'\nexport * from './venue.js'\nexport * from './video.js'\nexport * from './voice.js'\nexport * from './web-page.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/media/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,+CAA4B;AAC5B,4CAAyB;AACzB,gDAA6B;AAC7B,sDAAmC;AACnC,4CAAyB;AACzB,yDAAsC;AACtC,+CAA4B;AAC5B,gDAA6B;AAC7B,kDAA+B;AAC/B,6CAA0B;AAC1B,4CAAyB;AACzB,+CAA4B;AAC5B,6CAA0B;AAC1B,iDAA8B;AAC9B,6CAA0B;AAC1B,6CAA0B;AAC1B,6CAA0B;AAC1B,gDAA6B","sourcesContent":["export * from './audio.js'\nexport * from './contact.js'\nexport * from './dice.js'\nexport * from './document.js'\nexport * from './extended-media.js'\nexport * from './game.js'\nexport * from './input-media/index.js'\nexport * from './invoice.js'\nexport * from './location.js'\nexport * from './paid-media.js'\nexport * from './photo.js'\nexport * from './poll.js'\nexport * from './sticker.js'\nexport * from './story.js'\nexport * from './thumbnail.js'\nexport * from './venue.js'\nexport * from './video.js'\nexport * from './voice.js'\nexport * from './web-page.js'\n"]}
@@ -1,6 +1,6 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { InputFileLike } from '../../files/utils.js';
3
- import { CaptionMixin, InputMediaAudio, InputMediaAuto, InputMediaContact, InputMediaDice, InputMediaDocument, InputMediaGame, InputMediaGeo, InputMediaGeoLive, InputMediaInvoice, InputMediaLike, InputMediaPhoto, InputMediaPoll, InputMediaQuiz, InputMediaSticker, InputMediaStory, InputMediaVenue, InputMediaVideo, InputMediaVoice, InputMediaWebpage } from './types.js';
3
+ import { CaptionMixin, InputMediaAudio, InputMediaAuto, InputMediaContact, InputMediaDice, InputMediaDocument, InputMediaGame, InputMediaGeo, InputMediaGeoLive, InputMediaInvoice, InputMediaLike, InputMediaPaidMedia, InputMediaPhoto, InputMediaPoll, InputMediaQuiz, InputMediaSticker, InputMediaStory, InputMediaVenue, InputMediaVideo, InputMediaVoice, InputMediaWebpage } from './types.js';
4
4
  /** Omit `type` and `file` from the given type */
5
5
  export type OmitTypeAndFile<T extends InputMediaLike, K extends keyof T = never> = Omit<T, 'type' | 'file' | K>;
6
6
  /**
@@ -127,6 +127,7 @@ export declare function story(params: OmitTypeAndFile<InputMediaStory>): InputMe
127
127
  * @param params Additional parameters
128
128
  */
129
129
  export declare function webpage(url: string, params?: OmitTypeAndFile<InputMediaWebpage, 'url'>): InputMediaWebpage;
130
+ export declare function paid(params: OmitTypeAndFile<InputMediaPaidMedia>): InputMediaPaidMedia;
130
131
  /**
131
132
  * Create a document to be sent, which subtype
132
133
  * is inferred automatically by file contents.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.auto = exports.webpage = exports.story = exports.quiz = exports.poll = exports.invoice = exports.game = exports.contact = exports.dice = exports.geoLive = exports.geo = exports.venue = exports.sticker = exports.voice = exports.video = exports.photo = exports.document = exports.audio = exports.animation = void 0;
3
+ exports.auto = exports.paid = exports.webpage = exports.story = exports.quiz = exports.poll = exports.invoice = exports.game = exports.contact = exports.dice = exports.geoLive = exports.geo = exports.venue = exports.sticker = exports.voice = exports.video = exports.photo = exports.document = exports.audio = exports.animation = void 0;
4
4
  /**
5
5
  * Create an animation to be sent
6
6
  *
@@ -229,6 +229,12 @@ function webpage(url, params = {}) {
229
229
  return ret;
230
230
  }
231
231
  exports.webpage = webpage;
232
+ function paid(params) {
233
+ const ret = params;
234
+ ret.type = 'paid';
235
+ return ret;
236
+ }
237
+ exports.paid = paid;
232
238
  /**
233
239
  * Create a document to be sent, which subtype
234
240
  * is inferred automatically by file contents.
@@ -1 +1 @@
1
- {"version":3,"file":"factories.js","sourceRoot":"","sources":["../../../../../../src/highlevel/types/media/input-media/factories.ts"],"names":[],"mappings":";;;AA6BA;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAmB,EAAE,SAA2C,EAAE;IACxF,MAAM,GAAG,GAAG,MAAqC,CAAA;IACjD,GAAG,CAAC,IAAI,GAAG,OAAO,CAAA;IAClB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;IACf,GAAG,CAAC,UAAU,GAAG,IAAI,CAAA;IAErB,OAAO,GAAG,CAAA;AACd,CAAC;AAPD,8BAOC;AAED;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,IAAmB,EAAE,SAA2C,EAAE;IACpF,MAAM,GAAG,GAAG,MAAqC,CAAA;IACjD,GAAG,CAAC,IAAI,GAAG,OAAO,CAAA;IAClB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;IAEf,OAAO,GAAG,CAAA;AACd,CAAC;AAND,sBAMC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAmB,EAAE,SAA8C,EAAE;IAC1F,MAAM,GAAG,GAAG,MAAwC,CAAA;IACpD,GAAG,CAAC,IAAI,GAAG,UAAU,CAAA;IACrB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;IAEf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MAAM,GAAG,GAAG,MAAoC,CAAA;IAChD,GAAG,CAAC,IAAI,GAAG,MAAM,CAAA;IAEjB,OAAO,GAAG,CAAA;AACd,CAAC;AALD,oBAKC;AAED;;;;GAIG;AACH,SAAgB,IAAI,CAAC,MAAuC;IACxD,MAAM,GAAG,GAAG,MAAoC,CAAA;IAChD,GAAG,CAAC,IAAI,GAAG,MAAM,CAAA;IAEjB,OAAO,GAAG,CAAA;AACd,CAAC;AALD,oBAKC;AAED;;;;GAIG;AACH,SAAgB,KAAK,CAAC,MAAwC;IAC1D,MAAM,GAAG,GAAG,MAAqC,CAAA;IACjD,GAAG,CAAC,IAAI,GAAG,OAAO,CAAA;IAElB,OAAO,GAAG,CAAA;AACd,CAAC;AALD,sBAKC;AAED;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,GAAW,EAAE,SAAoD,EAAE;IACvF,MAAM,GAAG,GAAG,MAAuC,CAAA;IACnD,GAAG,CAAC,IAAI,GAAG,SAAS,CAAA;IACpB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAA;IAEb,OAAO,GAAG,CAAA;AACd,CAAC;AAND,0BAMC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,IAAI,CAAC,IAAmB,EAAE,SAA0C,EAAE;IAClF,MAAM,GAAG,GAAG,MAAoC,CAAA;IAChD,GAAG,CAAC,IAAI,GAAG,MAAM,CAAA;IACjB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;IAEf,OAAO,GAAG,CAAA;AACd,CAAC;AAND,oBAMC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { InputFileLike } from '../../files/utils.js'\nimport {\n CaptionMixin,\n InputMediaAudio,\n InputMediaAuto,\n InputMediaContact,\n InputMediaDice,\n InputMediaDocument,\n InputMediaGame,\n InputMediaGeo,\n InputMediaGeoLive,\n InputMediaInvoice,\n InputMediaLike,\n InputMediaPhoto,\n InputMediaPoll,\n InputMediaQuiz,\n InputMediaSticker,\n InputMediaStory,\n InputMediaVenue,\n InputMediaVideo,\n InputMediaVoice,\n InputMediaWebpage,\n} from './types.js'\n\n/** Omit `type` and `file` from the given type */\nexport type OmitTypeAndFile<T extends InputMediaLike, K extends keyof T = never> = Omit<T, 'type' | 'file' | K>\n\n/**\n * Create an animation to be sent\n *\n * @param file Animation\n * @param params Additional parameters\n */\nexport function animation(file: InputFileLike, params: OmitTypeAndFile<InputMediaVideo> = {}): InputMediaVideo {\n const ret = params as tl.Mutable<InputMediaVideo>\n ret.type = 'video'\n ret.file = file\n ret.isAnimated = true\n\n return ret\n}\n\n/**\n * Create an audio to be sent\n *\n * @param file Audio file\n * @param params Additional parameters\n */\nexport function audio(file: InputFileLike, params: OmitTypeAndFile<InputMediaAudio> = {}): InputMediaAudio {\n const ret = params as tl.Mutable<InputMediaAudio>\n ret.type = 'audio'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create an document to be sent\n *\n * @param file Document\n * @param params Additional parameters\n */\nexport function document(file: InputFileLike, params: OmitTypeAndFile<InputMediaDocument> = {}): InputMediaDocument {\n const ret = params as tl.Mutable<InputMediaDocument>\n ret.type = 'document'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create an photo to be sent\n *\n * @param file Photo\n * @param params Additional parameters\n */\nexport function photo(file: InputFileLike, params: OmitTypeAndFile<InputMediaPhoto> = {}): InputMediaPhoto {\n const ret = params as tl.Mutable<InputMediaPhoto>\n ret.type = 'photo'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create an video to be sent\n *\n * @param file Video\n * @param params Additional parameters\n */\nexport function video(file: InputFileLike, params: OmitTypeAndFile<InputMediaVideo> = {}): InputMediaVideo {\n const ret = params as tl.Mutable<InputMediaVideo>\n ret.type = 'video'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create a voice note to be sent\n *\n * @param file Voice note\n * @param params Additional parameters\n */\nexport function voice(file: InputFileLike, params: OmitTypeAndFile<InputMediaVoice> = {}): InputMediaVoice {\n const ret = params as tl.Mutable<InputMediaVoice>\n ret.type = 'voice'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create a sticker to be sent\n *\n * @param file Sticker\n * @param params Additional parameters\n */\nexport function sticker(file: InputFileLike, params: OmitTypeAndFile<InputMediaSticker> = {}): InputMediaSticker {\n const ret = params as tl.Mutable<InputMediaSticker>\n ret.type = 'sticker'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create a venue to be sent\n *\n * @param params Venue parameters\n */\nexport function venue(params: OmitTypeAndFile<InputMediaVenue>): InputMediaVenue {\n const ret = params as tl.Mutable<InputMediaVenue>\n ret.type = 'venue'\n\n return ret\n}\n\n/**\n * Create a geolocation to be sent\n *\n * @param latitude Latitude of the location\n * @param longitude Longitude of the location\n * @param params Additional parameters\n */\nexport function geo(\n latitude: number,\n longitude: number,\n params: OmitTypeAndFile<InputMediaGeo, 'latitude' | 'longitude'> = {},\n): InputMediaGeo {\n const ret = params as tl.Mutable<InputMediaGeo>\n ret.type = 'geo'\n ret.latitude = latitude\n ret.longitude = longitude\n\n return ret\n}\n\n/**\n * Create a live geolocation to be sent\n *\n * @param latitude Latitude of the current location\n * @param longitude Longitude of the current location\n * @param params Additional parameters\n */\nexport function geoLive(\n latitude: number,\n longitude: number,\n params: OmitTypeAndFile<InputMediaGeoLive, 'latitude' | 'longitude'> = {},\n): InputMediaGeoLive {\n const ret = params as tl.Mutable<InputMediaGeoLive>\n ret.type = 'geo_live'\n ret.latitude = latitude\n ret.longitude = longitude\n\n return ret\n}\n\n/**\n * Create a dice to be sent\n *\n * For convenience, known dice emojis are available\n * as static members of {@link Dice}.\n *\n * @param emoji Emoji representing the dice\n * @param params Additional parameters\n */\nexport function dice(emoji: string, params: CaptionMixin): InputMediaDice {\n const ret = params as tl.Mutable<InputMediaDice>\n ret.type = 'dice'\n\n return ret\n}\n\n/**\n * Create a contact to be sent\n *\n * @param params Contact parameters\n */\nexport function contact(params: OmitTypeAndFile<InputMediaContact>): InputMediaContact {\n const ret = params as tl.Mutable<InputMediaContact>\n ret.type = 'contact'\n\n return ret\n}\n\n/**\n * Create a game to be sent\n *\n * @param game Game short name or TL object representing one\n */\nexport function game(game: string | tl.TypeInputGame): InputMediaGame {\n return {\n type: 'game',\n game,\n }\n}\n\n/**\n * Create an invoice to be sent\n *\n * @param params Invoice parameters\n */\nexport function invoice(params: OmitTypeAndFile<InputMediaInvoice>): InputMediaInvoice {\n const ret = params as tl.Mutable<InputMediaInvoice>\n ret.type = 'invoice'\n\n return ret\n}\n\n/**\n * Create a poll to be sent\n *\n * @param params Poll parameters\n */\nexport function poll(params: OmitTypeAndFile<InputMediaPoll>): InputMediaPoll {\n const ret = params as tl.Mutable<InputMediaPoll>\n ret.type = 'poll'\n\n return ret\n}\n\n/**\n * Create a quiz to be sent\n *\n * @param params Quiz parameters\n */\nexport function quiz(params: OmitTypeAndFile<InputMediaQuiz>): InputMediaQuiz {\n const ret = params as tl.Mutable<InputMediaQuiz>\n ret.type = 'quiz'\n\n return ret\n}\n\n/**\n * Create a story to be sent\n *\n * @param params Story parameters\n */\nexport function story(params: OmitTypeAndFile<InputMediaStory>): InputMediaStory {\n const ret = params as tl.Mutable<InputMediaStory>\n ret.type = 'story'\n\n return ret\n}\n\n/**\n * Create a webpage to be sent\n *\n * @param url Webpage URL\n * @param params Additional parameters\n */\nexport function webpage(url: string, params: OmitTypeAndFile<InputMediaWebpage, 'url'> = {}): InputMediaWebpage {\n const ret = params as tl.Mutable<InputMediaWebpage>\n ret.type = 'webpage'\n ret.url = url\n\n return ret\n}\n\n/**\n * Create a document to be sent, which subtype\n * is inferred automatically by file contents.\n *\n * Photo type is only inferred for reused files,\n * newly uploaded photos with `auto` will be\n * uploaded as a document\n *\n * @param file The media file\n * @param params Additional parameters\n */\nexport function auto(file: InputFileLike, params: OmitTypeAndFile<InputMediaAuto> = {}): InputMediaAuto {\n const ret = params as tl.Mutable<InputMediaAuto>\n ret.type = 'auto'\n ret.file = file\n\n return ret\n}\n"]}
1
+ {"version":3,"file":"factories.js","sourceRoot":"","sources":["../../../../../../src/highlevel/types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AgB,OAAO,CAAC,GAAW,EAAE,SAAoD,EAAE;IACvF,MAAM,GAAG,GAAG,MAAuC,CAAA;IACnD,GAAG,CAAC,IAAI,GAAG,SAAS,CAAA;IACpB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAA;IAEb,OAAO,GAAG,CAAA;AACd,CAAC;AAND,0BAMC;AAED,SAAgB,IAAI,CAAC,MAA4C;IAC7D,MAAM,GAAG,GAAG,MAAyC,CAAA;IACrD,GAAG,CAAC,IAAI,GAAG,MAAM,CAAA;IAEjB,OAAO,GAAG,CAAA;AACd,CAAC;AALD,oBAKC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,IAAI,CAAC,IAAmB,EAAE,SAA0C,EAAE;IAClF,MAAM,GAAG,GAAG,MAAoC,CAAA;IAChD,GAAG,CAAC,IAAI,GAAG,MAAM,CAAA;IACjB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;IAEf,OAAO,GAAG,CAAA;AACd,CAAC;AAND,oBAMC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { InputFileLike } from '../../files/utils.js'\nimport {\n CaptionMixin,\n InputMediaAudio,\n InputMediaAuto,\n InputMediaContact,\n InputMediaDice,\n InputMediaDocument,\n InputMediaGame,\n InputMediaGeo,\n InputMediaGeoLive,\n InputMediaInvoice,\n InputMediaLike,\n InputMediaPaidMedia,\n InputMediaPhoto,\n InputMediaPoll,\n InputMediaQuiz,\n InputMediaSticker,\n InputMediaStory,\n InputMediaVenue,\n InputMediaVideo,\n InputMediaVoice,\n InputMediaWebpage,\n} from './types.js'\n\n/** Omit `type` and `file` from the given type */\nexport type OmitTypeAndFile<T extends InputMediaLike, K extends keyof T = never> = Omit<T, 'type' | 'file' | K>\n\n/**\n * Create an animation to be sent\n *\n * @param file Animation\n * @param params Additional parameters\n */\nexport function animation(file: InputFileLike, params: OmitTypeAndFile<InputMediaVideo> = {}): InputMediaVideo {\n const ret = params as tl.Mutable<InputMediaVideo>\n ret.type = 'video'\n ret.file = file\n ret.isAnimated = true\n\n return ret\n}\n\n/**\n * Create an audio to be sent\n *\n * @param file Audio file\n * @param params Additional parameters\n */\nexport function audio(file: InputFileLike, params: OmitTypeAndFile<InputMediaAudio> = {}): InputMediaAudio {\n const ret = params as tl.Mutable<InputMediaAudio>\n ret.type = 'audio'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create an document to be sent\n *\n * @param file Document\n * @param params Additional parameters\n */\nexport function document(file: InputFileLike, params: OmitTypeAndFile<InputMediaDocument> = {}): InputMediaDocument {\n const ret = params as tl.Mutable<InputMediaDocument>\n ret.type = 'document'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create an photo to be sent\n *\n * @param file Photo\n * @param params Additional parameters\n */\nexport function photo(file: InputFileLike, params: OmitTypeAndFile<InputMediaPhoto> = {}): InputMediaPhoto {\n const ret = params as tl.Mutable<InputMediaPhoto>\n ret.type = 'photo'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create an video to be sent\n *\n * @param file Video\n * @param params Additional parameters\n */\nexport function video(file: InputFileLike, params: OmitTypeAndFile<InputMediaVideo> = {}): InputMediaVideo {\n const ret = params as tl.Mutable<InputMediaVideo>\n ret.type = 'video'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create a voice note to be sent\n *\n * @param file Voice note\n * @param params Additional parameters\n */\nexport function voice(file: InputFileLike, params: OmitTypeAndFile<InputMediaVoice> = {}): InputMediaVoice {\n const ret = params as tl.Mutable<InputMediaVoice>\n ret.type = 'voice'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create a sticker to be sent\n *\n * @param file Sticker\n * @param params Additional parameters\n */\nexport function sticker(file: InputFileLike, params: OmitTypeAndFile<InputMediaSticker> = {}): InputMediaSticker {\n const ret = params as tl.Mutable<InputMediaSticker>\n ret.type = 'sticker'\n ret.file = file\n\n return ret\n}\n\n/**\n * Create a venue to be sent\n *\n * @param params Venue parameters\n */\nexport function venue(params: OmitTypeAndFile<InputMediaVenue>): InputMediaVenue {\n const ret = params as tl.Mutable<InputMediaVenue>\n ret.type = 'venue'\n\n return ret\n}\n\n/**\n * Create a geolocation to be sent\n *\n * @param latitude Latitude of the location\n * @param longitude Longitude of the location\n * @param params Additional parameters\n */\nexport function geo(\n latitude: number,\n longitude: number,\n params: OmitTypeAndFile<InputMediaGeo, 'latitude' | 'longitude'> = {},\n): InputMediaGeo {\n const ret = params as tl.Mutable<InputMediaGeo>\n ret.type = 'geo'\n ret.latitude = latitude\n ret.longitude = longitude\n\n return ret\n}\n\n/**\n * Create a live geolocation to be sent\n *\n * @param latitude Latitude of the current location\n * @param longitude Longitude of the current location\n * @param params Additional parameters\n */\nexport function geoLive(\n latitude: number,\n longitude: number,\n params: OmitTypeAndFile<InputMediaGeoLive, 'latitude' | 'longitude'> = {},\n): InputMediaGeoLive {\n const ret = params as tl.Mutable<InputMediaGeoLive>\n ret.type = 'geo_live'\n ret.latitude = latitude\n ret.longitude = longitude\n\n return ret\n}\n\n/**\n * Create a dice to be sent\n *\n * For convenience, known dice emojis are available\n * as static members of {@link Dice}.\n *\n * @param emoji Emoji representing the dice\n * @param params Additional parameters\n */\nexport function dice(emoji: string, params: CaptionMixin): InputMediaDice {\n const ret = params as tl.Mutable<InputMediaDice>\n ret.type = 'dice'\n\n return ret\n}\n\n/**\n * Create a contact to be sent\n *\n * @param params Contact parameters\n */\nexport function contact(params: OmitTypeAndFile<InputMediaContact>): InputMediaContact {\n const ret = params as tl.Mutable<InputMediaContact>\n ret.type = 'contact'\n\n return ret\n}\n\n/**\n * Create a game to be sent\n *\n * @param game Game short name or TL object representing one\n */\nexport function game(game: string | tl.TypeInputGame): InputMediaGame {\n return {\n type: 'game',\n game,\n }\n}\n\n/**\n * Create an invoice to be sent\n *\n * @param params Invoice parameters\n */\nexport function invoice(params: OmitTypeAndFile<InputMediaInvoice>): InputMediaInvoice {\n const ret = params as tl.Mutable<InputMediaInvoice>\n ret.type = 'invoice'\n\n return ret\n}\n\n/**\n * Create a poll to be sent\n *\n * @param params Poll parameters\n */\nexport function poll(params: OmitTypeAndFile<InputMediaPoll>): InputMediaPoll {\n const ret = params as tl.Mutable<InputMediaPoll>\n ret.type = 'poll'\n\n return ret\n}\n\n/**\n * Create a quiz to be sent\n *\n * @param params Quiz parameters\n */\nexport function quiz(params: OmitTypeAndFile<InputMediaQuiz>): InputMediaQuiz {\n const ret = params as tl.Mutable<InputMediaQuiz>\n ret.type = 'quiz'\n\n return ret\n}\n\n/**\n * Create a story to be sent\n *\n * @param params Story parameters\n */\nexport function story(params: OmitTypeAndFile<InputMediaStory>): InputMediaStory {\n const ret = params as tl.Mutable<InputMediaStory>\n ret.type = 'story'\n\n return ret\n}\n\n/**\n * Create a webpage to be sent\n *\n * @param url Webpage URL\n * @param params Additional parameters\n */\nexport function webpage(url: string, params: OmitTypeAndFile<InputMediaWebpage, 'url'> = {}): InputMediaWebpage {\n const ret = params as tl.Mutable<InputMediaWebpage>\n ret.type = 'webpage'\n ret.url = url\n\n return ret\n}\n\nexport function paid(params: OmitTypeAndFile<InputMediaPaidMedia>): InputMediaPaidMedia {\n const ret = params as tl.Mutable<InputMediaPaidMedia>\n ret.type = 'paid'\n\n return ret\n}\n\n/**\n * Create a document to be sent, which subtype\n * is inferred automatically by file contents.\n *\n * Photo type is only inferred for reused files,\n * newly uploaded photos with `auto` will be\n * uploaded as a document\n *\n * @param file The media file\n * @param params Additional parameters\n */\nexport function auto(file: InputFileLike, params: OmitTypeAndFile<InputMediaAuto> = {}): InputMediaAuto {\n const ret = params as tl.Mutable<InputMediaAuto>\n ret.type = 'auto'\n ret.file = file\n\n return ret\n}\n"]}
@@ -493,6 +493,17 @@ export interface InputMediaWebpage extends CaptionMixin {
493
493
  /** Webpage URL */
494
494
  url: string;
495
495
  }
496
+ export interface InputMediaPaidMedia extends CaptionMixin {
497
+ type: 'paid';
498
+ /**
499
+ * Media to be sent
500
+ */
501
+ media: MaybeArray<InputMediaLike>;
502
+ /**
503
+ * Amount of stars that should be paid for the media
504
+ */
505
+ starsAmount: number | tl.Long;
506
+ }
496
507
  /**
497
508
  * Input media that can be sent somewhere.
498
509
  *
@@ -502,4 +513,4 @@ export interface InputMediaWebpage extends CaptionMixin {
502
513
  *
503
514
  * @link InputMedia
504
515
  */
505
- export type InputMediaLike = InputMediaAudio | InputMediaVoice | InputMediaDocument | InputMediaPhoto | InputMediaVideo | InputMediaAuto | InputMediaSticker | InputMediaVenue | InputMediaGeo | InputMediaGeoLive | InputMediaDice | InputMediaContact | InputMediaGame | InputMediaInvoice | InputMediaPoll | InputMediaQuiz | InputMediaStory | InputMediaWebpage | tl.TypeInputMedia;
516
+ export type InputMediaLike = InputMediaAudio | InputMediaVoice | InputMediaDocument | InputMediaPhoto | InputMediaVideo | InputMediaAuto | InputMediaSticker | InputMediaVenue | InputMediaGeo | InputMediaGeoLive | InputMediaDice | InputMediaContact | InputMediaGame | InputMediaInvoice | InputMediaPoll | InputMediaQuiz | InputMediaStory | InputMediaWebpage | InputMediaPaidMedia | tl.TypeInputMedia;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/highlevel/types/media/input-media/types.ts"],"names":[],"mappings":"","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MaybeArray } from '../../../../types/utils.js'\nimport { InputText } from '../../../types/misc/entities.js'\nimport { InputFileLike } from '../../files/index.js'\nimport { InputPeerLike } from '../../peers/index.js'\nimport { VenueSource } from '../venue.js'\n\nexport interface CaptionMixin {\n /**\n * Caption of the media\n */\n caption?: InputText\n}\n\nexport interface FileMixin {\n /**\n * File to be sent\n */\n file: InputFileLike\n\n /**\n * Override file name for the file.\n *\n * Only applicable to newly uploaded files.\n */\n fileName?: string\n\n /**\n * Override MIME type for the file\n *\n * Only applicable to newly uploaded files.\n */\n fileMime?: string\n\n /**\n * Override file size for the file\n *\n * Only applicable to newly uploaded files.\n */\n fileSize?: number\n\n /**\n * TTL for the media in seconds.\n *\n * Only applicable to some media types\n */\n ttlSeconds?: number\n}\n\n/**\n * Automatically detect media type based on file contents.\n *\n * Photo type is only inferred for reused files,\n * newly uploaded photos with `auto` will be\n * uploaded as a document\n */\nexport interface InputMediaAuto extends FileMixin, CaptionMixin {\n type: 'auto'\n}\n\n/**\n * An audio file or voice message to be sent\n */\nexport interface InputMediaAudio extends FileMixin, CaptionMixin {\n type: 'audio'\n\n /**\n * Thumbnail of the audio file album cover.\n *\n * The thumbnail should be in JPEG format and less than 200 KB in size.\n * A thumbnail's width and height should not exceed 320 pixels.\n * Thumbnails can't be reused and can be only uploaded as a new file.\n *\n * Only applicable to newly uploaded files.\n */\n thumb?: InputFileLike\n\n /**\n * Duration of the audio in seconds\n *\n * Only applicable to newly uploaded files.\n */\n duration?: number\n\n /**\n * Performer of the audio\n *\n * Only applicable to newly uploaded files.\n */\n performer?: string\n\n /**\n * Title of the audio\n *\n * Only applicable to newly uploaded files.\n */\n title?: string\n}\n\n/**\n * Voice message to be sent\n */\nexport interface InputMediaVoice extends FileMixin, CaptionMixin {\n type: 'voice'\n\n /**\n * Duration of the voice message in seconds\n *\n * Only applicable to newly uploaded files.\n */\n duration?: number\n\n /**\n * Waveform of the voice message.\n *\n * Represented with integers in range [0, 31],\n * usually has length of 100.\n * Generated by the server if omitted.\n *\n * Only applicable to newly uploaded files.\n */\n waveform?: number[]\n}\n\n/**\n * A generic file to be sent\n */\nexport interface InputMediaDocument extends FileMixin, CaptionMixin {\n type: 'document'\n\n /**\n * Thumbnail of the document.\n *\n * The thumbnail should be in JPEG format and less than 200 KB in size.\n * A thumbnail's width and height should not exceed 320 pixels.\n * Thumbnails can't be reused and can be only uploaded as a new file.\n *\n * Only applicable to newly uploaded files.\n */\n thumb?: InputFileLike\n}\n\n/**\n * A photo to be sent\n */\nexport interface InputMediaPhoto extends FileMixin, CaptionMixin {\n type: 'photo'\n\n /**\n * Whether this photo should be hidden with a spoiler\n */\n spoiler?: boolean\n}\n\n/**\n * A sticker to be sent\n */\nexport interface InputMediaSticker extends FileMixin, CaptionMixin {\n type: 'sticker'\n\n /**\n * Whether this sticker is animated?\n *\n * Note that animated stickers must be in TGS\n * format, which is Lottie JSON compressed using GZip\n *\n * Only applicable to newly uploaded files.\n *\n * @default false\n */\n isAnimated?: boolean\n\n /**\n * An emoji representing this sticker\n *\n * Only applicable to newly uploaded files,\n * for some reason doesn't work with animated stickers.\n */\n alt?: string\n}\n\n/**\n * A video to be sent\n */\nexport interface InputMediaVideo extends FileMixin, CaptionMixin {\n type: 'video'\n\n /**\n * Thumbnail of the video.\n *\n * The thumbnail should be in JPEG format and less than 200 KB in size.\n * A thumbnail's width and height should not exceed 320 pixels.\n * Thumbnails can't be reused and can be only uploaded as a new file.\n *\n * Only applicable to newly uploaded files.\n */\n thumb?: InputFileLike\n\n /**\n * Width of the video in pixels\n *\n * Only applicable to newly uploaded files.\n */\n width?: number\n\n /**\n * Height of the video in pixels\n *\n * Only applicable to newly uploaded files.\n */\n height?: number\n\n /**\n * Duration of the video in seconds\n *\n * Only applicable to newly uploaded files.\n */\n duration?: number\n\n /**\n * Whether the video is suitable for streaming\n *\n * Only applicable to newly uploaded files.\n */\n supportsStreaming?: boolean\n\n /**\n * Whether this video is an animated GIF\n *\n * Only applicable to newly uploaded files.\n */\n isAnimated?: boolean\n\n /**\n * Whether this video is a round message (aka video note)\n *\n * Only applicable to newly uploaded files.\n */\n isRound?: boolean\n\n /**\n * Whether this video should be hidden with a spoiler\n */\n spoiler?: boolean\n}\n\n/**\n * A geolocation to be sent\n */\nexport interface InputMediaGeo extends CaptionMixin {\n type: 'geo'\n\n /**\n * Latitude of the geolocation\n */\n latitude: number\n\n /**\n * Longitude of the geolocation\n */\n longitude: number\n\n /**\n * The estimated horizontal accuracy of the\n * geolocation, in meters (0-1500)\n */\n accuracy?: number\n}\n\n/**\n * A live geolocation to be sent\n */\nexport interface InputMediaGeoLive extends Omit<InputMediaGeo, 'type'> {\n type: 'geo_live'\n\n /**\n * Whether sending of the geolocation has stopped\n */\n stopped?: boolean\n\n /**\n * Direction in which the location moves, in degrees (1-360)\n */\n heading?: number\n\n /**\n * Validity period of the live location\n */\n period?: number\n\n /**\n * Maximum distance to another chat member for proximity\n * alerts, in meters (0-100000)\n */\n proximityNotificationRadius?: number\n}\n\n/**\n * An animated dice with a random value to be sent\n *\n * For convenience, known dice emojis are available\n * as static members of {@link Dice}.\n *\n * Note that dice result value is generated randomly on the server,\n * you can't influence it in any way!\n */\nexport interface InputMediaDice extends CaptionMixin {\n type: 'dice'\n\n /**\n * Emoji representing a dice\n */\n emoji: string\n}\n\n/**\n * A venue to be sent\n */\nexport interface InputMediaVenue extends CaptionMixin {\n type: 'venue'\n\n /**\n * Latitude of the geolocation\n */\n latitude: number\n\n /**\n * Longitude of the geolocation\n */\n longitude: number\n\n /**\n * Venue name\n */\n title: string\n\n /**\n * Venue address\n */\n address: string\n\n /**\n * When available, source from where this venue was acquired\n */\n source?: VenueSource\n}\n\n/**\n * A contact to be sent\n */\nexport interface InputMediaContact extends CaptionMixin {\n type: 'contact'\n\n /**\n * Contact's phone number\n */\n phone: string\n\n /**\n * Contact's first name\n */\n firstName: string\n\n /**\n * Contact's last name\n */\n lastName?: string\n\n /**\n * Additional data about the contact\n * as a vCard (0-2048 bytes)\n */\n vcard?: string\n}\n\n/**\n * A game to be sent\n */\nexport interface InputMediaGame extends CaptionMixin {\n type: 'game'\n\n /**\n * Game's short name, or a TL object with an input game\n */\n game: string | tl.TypeInputGame\n}\n\n/**\n * An invoice to be sent (see https://core.telegram.org/bots/payments)\n */\nexport interface InputMediaInvoice extends CaptionMixin {\n type: 'invoice'\n\n /**\n * Product name (1-32 chars)\n */\n title: string\n\n /**\n * Product description (1-255 chars)\n */\n description: string\n\n /**\n * The invoice itself\n */\n invoice: tl.TypeInvoice\n\n /**\n * Bot-defined invoice payload (1-128 bytes).\n *\n * Will not be displayed to the user and can be used\n * for internal processes\n */\n payload: Uint8Array\n\n /**\n * Payments provider token, obtained from\n * [@BotFather](//t.me/botfather)\n */\n token: string\n\n /**\n * Data about the invoice as a plain JS object, which\n * will be shared with the payment provider. A detailed\n * description of required fields should be provided by\n * the payment provider.\n */\n providerData: unknown\n\n /**\n * Start parameter for the bot\n */\n startParam: string\n\n /**\n * Product photo. Can be a photo of the goods or a marketing image for a service.\n *\n * Can be a URL, or a TL object with input web document\n */\n photo?: string | tl.TypeInputWebDocument\n\n /**\n * Extended media (i.e. media that will be available once the invoice is paid)\n */\n extendedMedia?: InputMediaLike\n}\n\n/**\n * A simple poll to be sent\n *\n * > **Note**: when using user account,\n * > the poll can't be sent to PMs, only to channels/groups,\n * > otherwise there will be `MEDIA_INVALID` error.\n */\nexport interface InputMediaPoll extends CaptionMixin {\n type: 'poll'\n\n /**\n * Question of the poll (1-255 chars for users, 1-300 chars for bots)\n */\n question: InputText\n\n /**\n * Answers of the poll.\n *\n * You can either provide a string, or a\n * TL object representing an answer.\n * Strings will be transformed to TL\n * objects, with a single=byte incrementing\n * `option` value.\n */\n answers: (InputText | tl.TypePollAnswer)[]\n\n /**\n * Whether this is poll is closed\n * (i.e. nobody can vote anymore)\n */\n closed?: boolean\n\n /**\n * Whether this is a public poll\n * (i.e. users who have voted are visible to everyone)\n */\n public?: boolean\n\n /**\n * Whether users can select multiple answers\n * as an answer\n */\n multiple?: boolean\n\n /**\n * Amount of time in seconds the poll will be active after creation (5-600).\n *\n * Can't be used together with `closeDate`.\n */\n closePeriod?: number\n\n /**\n * Point in time when the poll will be automatically closed.\n *\n * Must be at least 5 and no more than 600 seconds in the future,\n * can't be used together with `closePeriod`.\n *\n * When `number` is used, UNIX time in ms is expected\n */\n closeDate?: number | Date\n}\n\n/**\n * A quiz to be sent.\n *\n * Quiz is an extended version of a poll, but quizzes have\n * correct answers, and votes can't be retracted from them\n */\nexport interface InputMediaQuiz extends Omit<InputMediaPoll, 'type'> {\n type: 'quiz'\n\n /**\n * Correct answer ID(s) or index(es).\n *\n * > **Note**: even though quizzes can actually\n * > only have exactly one correct answer,\n * > the API itself has the possibility to pass\n * > multiple or zero correct answers,\n * > but that would result in `QUIZ_CORRECT_ANSWERS_TOO_MUCH`\n * > and `QUIZ_CORRECT_ANSWERS_EMPTY` errors respectively.\n * >\n * > But since the API has that option, we also provide it,\n * > maybe to future-proof this :shrug:\n */\n correct: MaybeArray<number | Uint8Array>\n\n /**\n * Explanation of the quiz solution\n */\n solution?: InputText\n}\n\n/**\n * A story to be sent\n */\nexport interface InputMediaStory extends CaptionMixin {\n type: 'story'\n\n /**\n * Owner of the story\n */\n peer: InputPeerLike\n\n /**\n * ID of the story\n */\n id: number\n}\n\n/** A webpage to be sent */\nexport interface InputMediaWebpage extends CaptionMixin {\n type: 'webpage'\n\n /**\n * Whether the link must be present in the message\n * for the preview to appear\n */\n required?: boolean\n\n /**\n * By default, size of the media in the preview\n * is determined based on content type.\n *\n * You can override this behaviour by passing the wanted size here\n */\n size?: 'large' | 'small'\n\n /** Webpage URL */\n url: string\n}\n\n/**\n * Input media that can be sent somewhere.\n *\n * Note that meta-fields (like `duration`) are only\n * applicable if `file` is {@link UploadFileLike},\n * otherwise they are ignored.\n *\n * @link InputMedia\n */\nexport type InputMediaLike =\n | InputMediaAudio\n | InputMediaVoice\n | InputMediaDocument\n | InputMediaPhoto\n | InputMediaVideo\n | InputMediaAuto\n | InputMediaSticker\n | InputMediaVenue\n | InputMediaGeo\n | InputMediaGeoLive\n | InputMediaDice\n | InputMediaContact\n | InputMediaGame\n | InputMediaInvoice\n | InputMediaPoll\n | InputMediaQuiz\n | InputMediaStory\n | InputMediaWebpage\n | tl.TypeInputMedia\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/highlevel/types/media/input-media/types.ts"],"names":[],"mappings":"","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MaybeArray } from '../../../../types/utils.js'\nimport { InputText } from '../../../types/misc/entities.js'\nimport { InputFileLike } from '../../files/index.js'\nimport { InputPeerLike } from '../../peers/index.js'\nimport { VenueSource } from '../venue.js'\n\nexport interface CaptionMixin {\n /**\n * Caption of the media\n */\n caption?: InputText\n}\n\nexport interface FileMixin {\n /**\n * File to be sent\n */\n file: InputFileLike\n\n /**\n * Override file name for the file.\n *\n * Only applicable to newly uploaded files.\n */\n fileName?: string\n\n /**\n * Override MIME type for the file\n *\n * Only applicable to newly uploaded files.\n */\n fileMime?: string\n\n /**\n * Override file size for the file\n *\n * Only applicable to newly uploaded files.\n */\n fileSize?: number\n\n /**\n * TTL for the media in seconds.\n *\n * Only applicable to some media types\n */\n ttlSeconds?: number\n}\n\n/**\n * Automatically detect media type based on file contents.\n *\n * Photo type is only inferred for reused files,\n * newly uploaded photos with `auto` will be\n * uploaded as a document\n */\nexport interface InputMediaAuto extends FileMixin, CaptionMixin {\n type: 'auto'\n}\n\n/**\n * An audio file or voice message to be sent\n */\nexport interface InputMediaAudio extends FileMixin, CaptionMixin {\n type: 'audio'\n\n /**\n * Thumbnail of the audio file album cover.\n *\n * The thumbnail should be in JPEG format and less than 200 KB in size.\n * A thumbnail's width and height should not exceed 320 pixels.\n * Thumbnails can't be reused and can be only uploaded as a new file.\n *\n * Only applicable to newly uploaded files.\n */\n thumb?: InputFileLike\n\n /**\n * Duration of the audio in seconds\n *\n * Only applicable to newly uploaded files.\n */\n duration?: number\n\n /**\n * Performer of the audio\n *\n * Only applicable to newly uploaded files.\n */\n performer?: string\n\n /**\n * Title of the audio\n *\n * Only applicable to newly uploaded files.\n */\n title?: string\n}\n\n/**\n * Voice message to be sent\n */\nexport interface InputMediaVoice extends FileMixin, CaptionMixin {\n type: 'voice'\n\n /**\n * Duration of the voice message in seconds\n *\n * Only applicable to newly uploaded files.\n */\n duration?: number\n\n /**\n * Waveform of the voice message.\n *\n * Represented with integers in range [0, 31],\n * usually has length of 100.\n * Generated by the server if omitted.\n *\n * Only applicable to newly uploaded files.\n */\n waveform?: number[]\n}\n\n/**\n * A generic file to be sent\n */\nexport interface InputMediaDocument extends FileMixin, CaptionMixin {\n type: 'document'\n\n /**\n * Thumbnail of the document.\n *\n * The thumbnail should be in JPEG format and less than 200 KB in size.\n * A thumbnail's width and height should not exceed 320 pixels.\n * Thumbnails can't be reused and can be only uploaded as a new file.\n *\n * Only applicable to newly uploaded files.\n */\n thumb?: InputFileLike\n}\n\n/**\n * A photo to be sent\n */\nexport interface InputMediaPhoto extends FileMixin, CaptionMixin {\n type: 'photo'\n\n /**\n * Whether this photo should be hidden with a spoiler\n */\n spoiler?: boolean\n}\n\n/**\n * A sticker to be sent\n */\nexport interface InputMediaSticker extends FileMixin, CaptionMixin {\n type: 'sticker'\n\n /**\n * Whether this sticker is animated?\n *\n * Note that animated stickers must be in TGS\n * format, which is Lottie JSON compressed using GZip\n *\n * Only applicable to newly uploaded files.\n *\n * @default false\n */\n isAnimated?: boolean\n\n /**\n * An emoji representing this sticker\n *\n * Only applicable to newly uploaded files,\n * for some reason doesn't work with animated stickers.\n */\n alt?: string\n}\n\n/**\n * A video to be sent\n */\nexport interface InputMediaVideo extends FileMixin, CaptionMixin {\n type: 'video'\n\n /**\n * Thumbnail of the video.\n *\n * The thumbnail should be in JPEG format and less than 200 KB in size.\n * A thumbnail's width and height should not exceed 320 pixels.\n * Thumbnails can't be reused and can be only uploaded as a new file.\n *\n * Only applicable to newly uploaded files.\n */\n thumb?: InputFileLike\n\n /**\n * Width of the video in pixels\n *\n * Only applicable to newly uploaded files.\n */\n width?: number\n\n /**\n * Height of the video in pixels\n *\n * Only applicable to newly uploaded files.\n */\n height?: number\n\n /**\n * Duration of the video in seconds\n *\n * Only applicable to newly uploaded files.\n */\n duration?: number\n\n /**\n * Whether the video is suitable for streaming\n *\n * Only applicable to newly uploaded files.\n */\n supportsStreaming?: boolean\n\n /**\n * Whether this video is an animated GIF\n *\n * Only applicable to newly uploaded files.\n */\n isAnimated?: boolean\n\n /**\n * Whether this video is a round message (aka video note)\n *\n * Only applicable to newly uploaded files.\n */\n isRound?: boolean\n\n /**\n * Whether this video should be hidden with a spoiler\n */\n spoiler?: boolean\n}\n\n/**\n * A geolocation to be sent\n */\nexport interface InputMediaGeo extends CaptionMixin {\n type: 'geo'\n\n /**\n * Latitude of the geolocation\n */\n latitude: number\n\n /**\n * Longitude of the geolocation\n */\n longitude: number\n\n /**\n * The estimated horizontal accuracy of the\n * geolocation, in meters (0-1500)\n */\n accuracy?: number\n}\n\n/**\n * A live geolocation to be sent\n */\nexport interface InputMediaGeoLive extends Omit<InputMediaGeo, 'type'> {\n type: 'geo_live'\n\n /**\n * Whether sending of the geolocation has stopped\n */\n stopped?: boolean\n\n /**\n * Direction in which the location moves, in degrees (1-360)\n */\n heading?: number\n\n /**\n * Validity period of the live location\n */\n period?: number\n\n /**\n * Maximum distance to another chat member for proximity\n * alerts, in meters (0-100000)\n */\n proximityNotificationRadius?: number\n}\n\n/**\n * An animated dice with a random value to be sent\n *\n * For convenience, known dice emojis are available\n * as static members of {@link Dice}.\n *\n * Note that dice result value is generated randomly on the server,\n * you can't influence it in any way!\n */\nexport interface InputMediaDice extends CaptionMixin {\n type: 'dice'\n\n /**\n * Emoji representing a dice\n */\n emoji: string\n}\n\n/**\n * A venue to be sent\n */\nexport interface InputMediaVenue extends CaptionMixin {\n type: 'venue'\n\n /**\n * Latitude of the geolocation\n */\n latitude: number\n\n /**\n * Longitude of the geolocation\n */\n longitude: number\n\n /**\n * Venue name\n */\n title: string\n\n /**\n * Venue address\n */\n address: string\n\n /**\n * When available, source from where this venue was acquired\n */\n source?: VenueSource\n}\n\n/**\n * A contact to be sent\n */\nexport interface InputMediaContact extends CaptionMixin {\n type: 'contact'\n\n /**\n * Contact's phone number\n */\n phone: string\n\n /**\n * Contact's first name\n */\n firstName: string\n\n /**\n * Contact's last name\n */\n lastName?: string\n\n /**\n * Additional data about the contact\n * as a vCard (0-2048 bytes)\n */\n vcard?: string\n}\n\n/**\n * A game to be sent\n */\nexport interface InputMediaGame extends CaptionMixin {\n type: 'game'\n\n /**\n * Game's short name, or a TL object with an input game\n */\n game: string | tl.TypeInputGame\n}\n\n/**\n * An invoice to be sent (see https://core.telegram.org/bots/payments)\n */\nexport interface InputMediaInvoice extends CaptionMixin {\n type: 'invoice'\n\n /**\n * Product name (1-32 chars)\n */\n title: string\n\n /**\n * Product description (1-255 chars)\n */\n description: string\n\n /**\n * The invoice itself\n */\n invoice: tl.TypeInvoice\n\n /**\n * Bot-defined invoice payload (1-128 bytes).\n *\n * Will not be displayed to the user and can be used\n * for internal processes\n */\n payload: Uint8Array\n\n /**\n * Payments provider token, obtained from\n * [@BotFather](//t.me/botfather)\n */\n token: string\n\n /**\n * Data about the invoice as a plain JS object, which\n * will be shared with the payment provider. A detailed\n * description of required fields should be provided by\n * the payment provider.\n */\n providerData: unknown\n\n /**\n * Start parameter for the bot\n */\n startParam: string\n\n /**\n * Product photo. Can be a photo of the goods or a marketing image for a service.\n *\n * Can be a URL, or a TL object with input web document\n */\n photo?: string | tl.TypeInputWebDocument\n\n /**\n * Extended media (i.e. media that will be available once the invoice is paid)\n */\n extendedMedia?: InputMediaLike\n}\n\n/**\n * A simple poll to be sent\n *\n * > **Note**: when using user account,\n * > the poll can't be sent to PMs, only to channels/groups,\n * > otherwise there will be `MEDIA_INVALID` error.\n */\nexport interface InputMediaPoll extends CaptionMixin {\n type: 'poll'\n\n /**\n * Question of the poll (1-255 chars for users, 1-300 chars for bots)\n */\n question: InputText\n\n /**\n * Answers of the poll.\n *\n * You can either provide a string, or a\n * TL object representing an answer.\n * Strings will be transformed to TL\n * objects, with a single=byte incrementing\n * `option` value.\n */\n answers: (InputText | tl.TypePollAnswer)[]\n\n /**\n * Whether this is poll is closed\n * (i.e. nobody can vote anymore)\n */\n closed?: boolean\n\n /**\n * Whether this is a public poll\n * (i.e. users who have voted are visible to everyone)\n */\n public?: boolean\n\n /**\n * Whether users can select multiple answers\n * as an answer\n */\n multiple?: boolean\n\n /**\n * Amount of time in seconds the poll will be active after creation (5-600).\n *\n * Can't be used together with `closeDate`.\n */\n closePeriod?: number\n\n /**\n * Point in time when the poll will be automatically closed.\n *\n * Must be at least 5 and no more than 600 seconds in the future,\n * can't be used together with `closePeriod`.\n *\n * When `number` is used, UNIX time in ms is expected\n */\n closeDate?: number | Date\n}\n\n/**\n * A quiz to be sent.\n *\n * Quiz is an extended version of a poll, but quizzes have\n * correct answers, and votes can't be retracted from them\n */\nexport interface InputMediaQuiz extends Omit<InputMediaPoll, 'type'> {\n type: 'quiz'\n\n /**\n * Correct answer ID(s) or index(es).\n *\n * > **Note**: even though quizzes can actually\n * > only have exactly one correct answer,\n * > the API itself has the possibility to pass\n * > multiple or zero correct answers,\n * > but that would result in `QUIZ_CORRECT_ANSWERS_TOO_MUCH`\n * > and `QUIZ_CORRECT_ANSWERS_EMPTY` errors respectively.\n * >\n * > But since the API has that option, we also provide it,\n * > maybe to future-proof this :shrug:\n */\n correct: MaybeArray<number | Uint8Array>\n\n /**\n * Explanation of the quiz solution\n */\n solution?: InputText\n}\n\n/**\n * A story to be sent\n */\nexport interface InputMediaStory extends CaptionMixin {\n type: 'story'\n\n /**\n * Owner of the story\n */\n peer: InputPeerLike\n\n /**\n * ID of the story\n */\n id: number\n}\n\n/** A webpage to be sent */\nexport interface InputMediaWebpage extends CaptionMixin {\n type: 'webpage'\n\n /**\n * Whether the link must be present in the message\n * for the preview to appear\n */\n required?: boolean\n\n /**\n * By default, size of the media in the preview\n * is determined based on content type.\n *\n * You can override this behaviour by passing the wanted size here\n */\n size?: 'large' | 'small'\n\n /** Webpage URL */\n url: string\n}\n\nexport interface InputMediaPaidMedia extends CaptionMixin {\n type: 'paid'\n\n /**\n * Media to be sent\n */\n media: MaybeArray<InputMediaLike>\n\n /**\n * Amount of stars that should be paid for the media\n */\n starsAmount: number | tl.Long\n}\n\n/**\n * Input media that can be sent somewhere.\n *\n * Note that meta-fields (like `duration`) are only\n * applicable if `file` is {@link UploadFileLike},\n * otherwise they are ignored.\n *\n * @link InputMedia\n */\nexport type InputMediaLike =\n | InputMediaAudio\n | InputMediaVoice\n | InputMediaDocument\n | InputMediaPhoto\n | InputMediaVideo\n | InputMediaAuto\n | InputMediaSticker\n | InputMediaVenue\n | InputMediaGeo\n | InputMediaGeoLive\n | InputMediaDice\n | InputMediaContact\n | InputMediaGame\n | InputMediaInvoice\n | InputMediaPoll\n | InputMediaQuiz\n | InputMediaStory\n | InputMediaWebpage\n | InputMediaPaidMedia\n | tl.TypeInputMedia\n"]}
@@ -1,7 +1,7 @@
1
1
  import { tl } from '@mtcute/tl';
2
2
  import { WebDocument } from '../files/web-document.js';
3
3
  import type { MessageMedia } from '../messages/message-media.js';
4
- import { Thumbnail } from './thumbnail.js';
4
+ import { ExtendedMediaPreview } from './extended-media.js';
5
5
  /**
6
6
  * Information about invoice's extended media.
7
7
  * - `none`: there is no extended media in this invoice
@@ -9,24 +9,6 @@ import { Thumbnail } from './thumbnail.js';
9
9
  * - `full`: there is a full version of this invoice's media available ({@link Invoice.extendedMedia})
10
10
  */
11
11
  export type InvoiceExtendedMediaState = 'none' | 'preview' | 'full';
12
- export declare class InvoiceExtendedMediaPreview {
13
- readonly raw: tl.RawMessageExtendedMediaPreview;
14
- constructor(raw: tl.RawMessageExtendedMediaPreview);
15
- /**
16
- * Width of the preview, in pixels (if available, else 0)
17
- */
18
- get width(): number;
19
- /**
20
- * Height of the preview, in pixels (if available, else 0)
21
- */
22
- get height(): number;
23
- get thumbnail(): Thumbnail | null;
24
- /**
25
- * If this is a video, the duration of the video,
26
- * in seconds (if available, else 0)
27
- */
28
- get videoDuration(): number;
29
- }
30
12
  /**
31
13
  * An invoice
32
14
  */
@@ -86,7 +68,7 @@ export declare class Invoice {
86
68
  * Only available if {@link extendedMediaState} is `preview`.
87
69
  * Otherwise, throws an error.
88
70
  */
89
- get extendedMediaPreview(): InvoiceExtendedMediaPreview;
71
+ get extendedMediaPreview(): ExtendedMediaPreview;
90
72
  /**
91
73
  * Get the invoice's extended media.
92
74
  * Only available if {@link extendedMediaState} is `full`.
@@ -1,45 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Invoice = exports.InvoiceExtendedMediaPreview = void 0;
3
+ exports.Invoice = void 0;
4
4
  const errors_js_1 = require("../../../types/errors.js");
5
5
  const index_js_1 = require("../../utils/index.js");
6
6
  const memoize_js_1 = require("../../utils/memoize.js");
7
7
  const web_document_js_1 = require("../files/web-document.js");
8
- const thumbnail_js_1 = require("./thumbnail.js");
9
- class InvoiceExtendedMediaPreview {
10
- raw;
11
- constructor(raw) {
12
- this.raw = raw;
13
- }
14
- /**
15
- * Width of the preview, in pixels (if available, else 0)
16
- */
17
- get width() {
18
- return this.raw.w ?? 0;
19
- }
20
- /**
21
- * Height of the preview, in pixels (if available, else 0)
22
- */
23
- get height() {
24
- return this.raw.h ?? 0;
25
- }
26
- get thumbnail() {
27
- if (!this.raw.thumb) {
28
- return null;
29
- }
30
- return new thumbnail_js_1.Thumbnail(this.raw, this.raw.thumb);
31
- }
32
- /**
33
- * If this is a video, the duration of the video,
34
- * in seconds (if available, else 0)
35
- */
36
- get videoDuration() {
37
- return this.raw.videoDuration ?? 0;
38
- }
39
- }
40
- exports.InvoiceExtendedMediaPreview = InvoiceExtendedMediaPreview;
41
- (0, memoize_js_1.memoizeGetters)(InvoiceExtendedMediaPreview, ['thumbnail']);
42
- (0, index_js_1.makeInspectable)(InvoiceExtendedMediaPreview);
8
+ const extended_media_js_1 = require("./extended-media.js");
43
9
  /**
44
10
  * An invoice
45
11
  */
@@ -133,7 +99,7 @@ class Invoice {
133
99
  if (this.raw.extendedMedia?._ !== 'messageExtendedMediaPreview') {
134
100
  throw new errors_js_1.MtArgumentError('No extended media preview available');
135
101
  }
136
- return new InvoiceExtendedMediaPreview(this.raw.extendedMedia);
102
+ return new extended_media_js_1.ExtendedMediaPreview(this.raw.extendedMedia);
137
103
  }
138
104
  /**
139
105
  * Get the invoice's extended media.
@@ -1 +1 @@
1
- {"version":3,"file":"invoice.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/media/invoice.ts"],"names":[],"mappings":";;;AAEA,wDAA0D;AAC1D,mDAAsD;AACtD,uDAAuD;AACvD,8DA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EAAE,CAAC;YACvB,MAAM,IAAI,2BAAe,CAAC,6BAA6B,CAAC,CAAA;QAC5D,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAA;IAC9B,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,UAAU;QACV,MAAM,IAAI,2BAAe,CAAC,sCAAsC,CAAC,CAAA;IACrE,CAAC;CACJ;AAnID,0BAmIC;AAED,IAAA,2BAAc,EAAC,OAAO,EAAE,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAA;AAC1D,IAAA,0BAAe,EAAC,OAAO,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtArgumentError } from '../../../types/errors.js'\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { WebDocument } from '../files/web-document.js'\nimport type { MessageMedia } from '../messages/message-media.js'\nimport { Thumbnail } from './thumbnail.js'\n\n/**\n * Information about invoice's extended media.\n * - `none`: there is no extended media in this invoice\n * - `preview`: there is only a preview of this invoice's media ({@link Invoice.extendedMediaPreview})\n * - `full`: there is a full version of this invoice's media available ({@link Invoice.extendedMedia})\n */\nexport type InvoiceExtendedMediaState = 'none' | 'preview' | 'full'\n\nexport class InvoiceExtendedMediaPreview {\n constructor(public readonly raw: tl.RawMessageExtendedMediaPreview) {}\n\n /**\n * Width of the preview, in pixels (if available, else 0)\n */\n get width(): number {\n return this.raw.w ?? 0\n }\n\n /**\n * Height of the preview, in pixels (if available, else 0)\n */\n get height(): number {\n return this.raw.h ?? 0\n }\n\n get thumbnail(): Thumbnail | null {\n if (!this.raw.thumb) {\n return null\n }\n\n return new Thumbnail(this.raw, this.raw.thumb)\n }\n\n /**\n * If this is a video, the duration of the video,\n * in seconds (if available, else 0)\n */\n get videoDuration(): number {\n return this.raw.videoDuration ?? 0\n }\n}\n\nmemoizeGetters(InvoiceExtendedMediaPreview, ['thumbnail'])\nmakeInspectable(InvoiceExtendedMediaPreview)\n\n/**\n * An invoice\n */\nexport class Invoice {\n readonly type = 'invoice' as const\n\n constructor(\n readonly raw: tl.RawMessageMediaInvoice,\n private readonly _extendedMedia?: MessageMedia,\n ) {}\n\n /**\n * Whether the shipping address was requested\n */\n isShippingAddressRequested(): boolean {\n return this.raw.shippingAddressRequested!\n }\n\n /**\n * Whether this is an example (test) invoice\n */\n isTest(): boolean {\n return this.raw.test!\n }\n\n /**\n * Product name, 1-32 characters\n */\n get title(): string {\n return this.raw.title\n }\n\n /**\n * Product description, 1-255 characters\n */\n get description(): string {\n return this.raw.description\n }\n\n /**\n * URL of the product photo for the invoice\n */\n get photo(): WebDocument | null {\n if (!this.raw.photo) return null\n\n return new WebDocument(this.raw.photo)\n }\n\n /**\n * Message ID of receipt\n */\n get receiptMessageId(): number | null {\n return this.raw.receiptMsgId ?? null\n }\n\n /**\n * Three-letter ISO 4217 currency code\n */\n get currency(): string {\n return this.raw.currency\n }\n\n /**\n * Total price in the smallest units of the currency\n * (integer, not float/double). For example, for a price\n * of `US$ 1.45` `amount = 145`.\n *\n * See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json),\n * it shows the number of digits past the decimal point\n * for each currency (2 for the majority of currencies).\n */\n get amount(): tl.Long {\n return this.raw.totalAmount\n }\n\n /**\n * Unique bot deep-linking parameter that can be used to generate this invoice\n */\n get startParam(): string {\n return this.raw.startParam\n }\n\n /**\n * If this invoice has extended media\n */\n get extendedMediaState(): InvoiceExtendedMediaState {\n if (!this.raw.extendedMedia) return 'none'\n\n if (this.raw.extendedMedia._ === 'messageExtendedMediaPreview') {\n return 'preview'\n }\n\n return 'full'\n }\n\n /**\n * Get the invoice's extended media preview.\n * Only available if {@link extendedMediaState} is `preview`.\n * Otherwise, throws an error.\n */\n get extendedMediaPreview(): InvoiceExtendedMediaPreview {\n if (this.raw.extendedMedia?._ !== 'messageExtendedMediaPreview') {\n throw new MtArgumentError('No extended media preview available')\n }\n\n return new InvoiceExtendedMediaPreview(this.raw.extendedMedia)\n }\n\n /**\n * Get the invoice's extended media.\n * Only available if {@link extendedMediaState} is `full`.\n * Otherwise, throws an error.\n */\n get extendedMedia(): MessageMedia {\n if (!this._extendedMedia) {\n throw new MtArgumentError('No extended media available')\n }\n\n return this._extendedMedia\n }\n\n /**\n * Input media TL object generated from this object,\n * to be used inside {@link InputMediaLike} and\n * {@link TelegramClient.sendMedia}.\n *\n * Invoice can't provide an input media, since some\n * of the data is not available to the user,\n * which is required to send it. This getter\n * is only provided to allow using `msg.media.inputMedia`\n */\n get inputMedia(): tl.TypeInputMedia {\n throw new MtArgumentError('Invoice cannot provide an InputMedia')\n }\n}\n\nmemoizeGetters(Invoice, ['extendedMediaPreview', 'photo'])\nmakeInspectable(Invoice, undefined, ['inputMedia'])\n"]}
1
+ {"version":3,"file":"invoice.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/media/invoice.ts"],"names":[],"mappings":";;;AAEA,wDAA0D;AAC1D,mDAAsD;AACtD,uDAAuD;AACvD,8DAAsD;AAEtD,2DAA0D;AAU1D;;GAEG;AACH,MAAa,OAAO;IAIH;IACQ;IAJZ,IAAI,GAAG,SAAkB,CAAA;IAElC,YACa,GAA8B,EACtB,cAA6B;QADrC,QAAG,GAAH,GAAG,CAA2B;QACtB,mBAAc,GAAd,cAAc,CAAe;IAC/C,CAAC;IAEJ;;OAEG;IACH,0BAA0B;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAyB,CAAA;IAC7C,CAAC;IAED;;OAEG;IACH,MAAM;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAK,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACL,IAAI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AC9B,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,UAAU;QACV,MAAM,IAAI,2BAAe,CAAC,sCAAsC,CAAC,CAAA;IACrE,CAAC;CACJ;AAnID,0BAmIC;AAED,IAAA,2BAAc,EAAC,OAAO,EAAE,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAA;AAC1D,IAAA,0BAAe,EAAC,OAAO,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtArgumentError } from '../../../types/errors.js'\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { WebDocument } from '../files/web-document.js'\nimport type { MessageMedia } from '../messages/message-media.js'\nimport { ExtendedMediaPreview } from './extended-media.js'\n\n/**\n * Information about invoice's extended media.\n * - `none`: there is no extended media in this invoice\n * - `preview`: there is only a preview of this invoice's media ({@link Invoice.extendedMediaPreview})\n * - `full`: there is a full version of this invoice's media available ({@link Invoice.extendedMedia})\n */\nexport type InvoiceExtendedMediaState = 'none' | 'preview' | 'full'\n\n/**\n * An invoice\n */\nexport class Invoice {\n readonly type = 'invoice' as const\n\n constructor(\n readonly raw: tl.RawMessageMediaInvoice,\n private readonly _extendedMedia?: MessageMedia,\n ) {}\n\n /**\n * Whether the shipping address was requested\n */\n isShippingAddressRequested(): boolean {\n return this.raw.shippingAddressRequested!\n }\n\n /**\n * Whether this is an example (test) invoice\n */\n isTest(): boolean {\n return this.raw.test!\n }\n\n /**\n * Product name, 1-32 characters\n */\n get title(): string {\n return this.raw.title\n }\n\n /**\n * Product description, 1-255 characters\n */\n get description(): string {\n return this.raw.description\n }\n\n /**\n * URL of the product photo for the invoice\n */\n get photo(): WebDocument | null {\n if (!this.raw.photo) return null\n\n return new WebDocument(this.raw.photo)\n }\n\n /**\n * Message ID of receipt\n */\n get receiptMessageId(): number | null {\n return this.raw.receiptMsgId ?? null\n }\n\n /**\n * Three-letter ISO 4217 currency code\n */\n get currency(): string {\n return this.raw.currency\n }\n\n /**\n * Total price in the smallest units of the currency\n * (integer, not float/double). For example, for a price\n * of `US$ 1.45` `amount = 145`.\n *\n * See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json),\n * it shows the number of digits past the decimal point\n * for each currency (2 for the majority of currencies).\n */\n get amount(): tl.Long {\n return this.raw.totalAmount\n }\n\n /**\n * Unique bot deep-linking parameter that can be used to generate this invoice\n */\n get startParam(): string {\n return this.raw.startParam\n }\n\n /**\n * If this invoice has extended media\n */\n get extendedMediaState(): InvoiceExtendedMediaState {\n if (!this.raw.extendedMedia) return 'none'\n\n if (this.raw.extendedMedia._ === 'messageExtendedMediaPreview') {\n return 'preview'\n }\n\n return 'full'\n }\n\n /**\n * Get the invoice's extended media preview.\n * Only available if {@link extendedMediaState} is `preview`.\n * Otherwise, throws an error.\n */\n get extendedMediaPreview(): ExtendedMediaPreview {\n if (this.raw.extendedMedia?._ !== 'messageExtendedMediaPreview') {\n throw new MtArgumentError('No extended media preview available')\n }\n\n return new ExtendedMediaPreview(this.raw.extendedMedia)\n }\n\n /**\n * Get the invoice's extended media.\n * Only available if {@link extendedMediaState} is `full`.\n * Otherwise, throws an error.\n */\n get extendedMedia(): MessageMedia {\n if (!this._extendedMedia) {\n throw new MtArgumentError('No extended media available')\n }\n\n return this._extendedMedia\n }\n\n /**\n * Input media TL object generated from this object,\n * to be used inside {@link InputMediaLike} and\n * {@link TelegramClient.sendMedia}.\n *\n * Invoice can't provide an input media, since some\n * of the data is not available to the user,\n * which is required to send it. This getter\n * is only provided to allow using `msg.media.inputMedia`\n */\n get inputMedia(): tl.TypeInputMedia {\n throw new MtArgumentError('Invoice cannot provide an InputMedia')\n }\n}\n\nmemoizeGetters(Invoice, ['extendedMediaPreview', 'photo'])\nmakeInspectable(Invoice, undefined, ['inputMedia'])\n"]}
@@ -0,0 +1,33 @@
1
+ import { tl } from '@mtcute/tl';
2
+ import { MessageMedia } from '../messages/message-media.js';
3
+ import { ExtendedMediaPreview } from './extended-media.js';
4
+ export declare class PaidMedia {
5
+ readonly raw: tl.RawMessageMediaPaidMedia;
6
+ private readonly _extendedMedia;
7
+ readonly type: "paid";
8
+ constructor(raw: tl.RawMessageMediaPaidMedia, _extendedMedia: MessageMedia[]);
9
+ /** Whether this media was paid for */
10
+ get isPaid(): boolean;
11
+ /** Price of the media (in Telegram Stars) */
12
+ get price(): tl.Long;
13
+ /**
14
+ * Get the available media previews.
15
+ *
16
+ * If the media is already paid for, this will return an empty array.
17
+ */
18
+ get previews(): ExtendedMediaPreview[];
19
+ /**
20
+ * Get the available full media.
21
+ *
22
+ * If the media is not paid for, this will return an empty array.
23
+ */
24
+ get medias(): MessageMedia[];
25
+ /**
26
+ * Input media TL object generated from this object,
27
+ * to be used inside {@link InputMediaLike} and
28
+ * {@link TelegramClient.sendMedia}.
29
+ *
30
+ * Will throw if the media is not paid for.
31
+ */
32
+ get inputMedia(): tl.TypeInputMedia;
33
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaidMedia = void 0;
4
+ const inspectable_js_1 = require("../../utils/inspectable.js");
5
+ const memoize_js_1 = require("../../utils/memoize.js");
6
+ const extended_media_js_1 = require("./extended-media.js");
7
+ class PaidMedia {
8
+ raw;
9
+ _extendedMedia;
10
+ type = 'paid';
11
+ constructor(raw, _extendedMedia) {
12
+ this.raw = raw;
13
+ this._extendedMedia = _extendedMedia;
14
+ }
15
+ /** Whether this media was paid for */
16
+ get isPaid() {
17
+ return this._extendedMedia !== undefined;
18
+ }
19
+ /** Price of the media (in Telegram Stars) */
20
+ get price() {
21
+ return this.raw.starsAmount;
22
+ }
23
+ /**
24
+ * Get the available media previews.
25
+ *
26
+ * If the media is already paid for, this will return an empty array.
27
+ */
28
+ get previews() {
29
+ const res = [];
30
+ this.raw.extendedMedia.forEach((m) => {
31
+ if (m._ !== 'messageExtendedMediaPreview')
32
+ return;
33
+ res.push(new extended_media_js_1.ExtendedMediaPreview(m));
34
+ });
35
+ return res;
36
+ }
37
+ /**
38
+ * Get the available full media.
39
+ *
40
+ * If the media is not paid for, this will return an empty array.
41
+ */
42
+ get medias() {
43
+ return this._extendedMedia;
44
+ }
45
+ /**
46
+ * Input media TL object generated from this object,
47
+ * to be used inside {@link InputMediaLike} and
48
+ * {@link TelegramClient.sendMedia}.
49
+ *
50
+ * Will throw if the media is not paid for.
51
+ */
52
+ get inputMedia() {
53
+ if (!this.isPaid) {
54
+ throw new Error('Cannot get input media for non-paid media');
55
+ }
56
+ return {
57
+ _: 'inputMediaPaidMedia',
58
+ starsAmount: this.raw.starsAmount,
59
+ extendedMedia: this._extendedMedia.map((m) => m.inputMedia),
60
+ };
61
+ }
62
+ }
63
+ exports.PaidMedia = PaidMedia;
64
+ (0, inspectable_js_1.makeInspectable)(PaidMedia, undefined, ['inputMedia']);
65
+ (0, memoize_js_1.memoizeGetters)(PaidMedia, ['previews', 'inputMedia']);
66
+ //# sourceMappingURL=paid-media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paid-media.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/media/paid-media.ts"],"names":[],"mappings":";;;AAEA,+DAA4D;AAC5D,uDAAuD;AAEvD,2DAA0D;AAE1D,MAAa,SAAS;IAIL;IACQ;IAJZ,IAAI,GAAG,MAAe,CAAA;IAE/B,YACa,GAAgC,EACxB,cAA8B;QADtC,QAAG,GAAH,GAAG,CAA6B;QACxB,mBAAc,GAAd,cAAc,CAAgB;IAChD,CAAC;IAEJ,sCAAsC;IACtC,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,CAAA;IAC5C,CAAC;IAED,6CAA6C;IAC7C,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAA;IAC/B,CAAC;IAED;;;;OAIG;IACH,IAAI,QAAQ;QACR,MAAM,GAAG,GAA2B,EAAE,CAAA;QAEtC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACjC,IAAI,CAAC,CAAC,CAAC,KAAK,6BAA6B;gBAAE,OAAM;YAEjD,GAAG,CAAC,IAAI,CAAC,IAAI,wCAAoB,CAAC,CAAC,CAAC,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,CAAA;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,cAAc,CAAA;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,UAAU;QACV,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAChE,CAAC;QAED,OAAO;YACH,CAAC,EAAE,qBAAqB;YACxB,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW;YACjC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAE,CAAC,UAAU,CAAC;SAC/D,CAAA;IACL,CAAC;CACJ;AA9DD,8BA8DC;AAED,IAAA,gCAAe,EAAC,SAAS,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;AACrD,IAAA,2BAAc,EAAC,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { makeInspectable } from '../../utils/inspectable.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { MessageMedia } from '../messages/message-media.js'\nimport { ExtendedMediaPreview } from './extended-media.js'\n\nexport class PaidMedia {\n readonly type = 'paid' as const\n\n constructor(\n readonly raw: tl.RawMessageMediaPaidMedia,\n private readonly _extendedMedia: MessageMedia[],\n ) {}\n\n /** Whether this media was paid for */\n get isPaid(): boolean {\n return this._extendedMedia !== undefined\n }\n\n /** Price of the media (in Telegram Stars) */\n get price(): tl.Long {\n return this.raw.starsAmount\n }\n\n /**\n * Get the available media previews.\n *\n * If the media is already paid for, this will return an empty array.\n */\n get previews(): ExtendedMediaPreview[] {\n const res: ExtendedMediaPreview[] = []\n\n this.raw.extendedMedia.forEach((m) => {\n if (m._ !== 'messageExtendedMediaPreview') return\n\n res.push(new ExtendedMediaPreview(m))\n })\n\n return res\n }\n\n /**\n * Get the available full media.\n *\n * If the media is not paid for, this will return an empty array.\n */\n get medias(): MessageMedia[] {\n return this._extendedMedia\n }\n\n /**\n * Input media TL object generated from this object,\n * to be used inside {@link InputMediaLike} and\n * {@link TelegramClient.sendMedia}.\n *\n * Will throw if the media is not paid for.\n */\n get inputMedia(): tl.TypeInputMedia {\n if (!this.isPaid) {\n throw new Error('Cannot get input media for non-paid media')\n }\n\n return {\n _: 'inputMediaPaidMedia',\n starsAmount: this.raw.starsAmount,\n extendedMedia: this._extendedMedia.map((m) => m!.inputMedia),\n }\n }\n}\n\nmakeInspectable(PaidMedia, undefined, ['inputMedia'])\nmemoizeGetters(PaidMedia, ['previews', 'inputMedia'])\n"]}
@@ -6,6 +6,7 @@ import { Document } from '../media/document.js';
6
6
  import { Game } from '../media/game.js';
7
7
  import { Invoice } from '../media/invoice.js';
8
8
  import { LiveLocation, Location } from '../media/location.js';
9
+ import { PaidMedia } from '../media/paid-media.js';
9
10
  import { Photo } from '../media/photo.js';
10
11
  import { Poll } from '../media/poll.js';
11
12
  import { Sticker } from '../media/sticker.js';
@@ -16,7 +17,7 @@ import { Voice } from '../media/voice.js';
16
17
  import { WebPage } from '../media/web-page.js';
17
18
  import { PeersIndex } from '../peers/peers-index.js';
18
19
  /** A media inside of a {@link Message} */
19
- export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game | WebPage | Venue | Poll | Invoice | MediaStory | null;
20
+ export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game | WebPage | Venue | Poll | Invoice | MediaStory | PaidMedia | null;
20
21
  export type MessageMediaType = Exclude<MessageMedia, null>['type'];
21
22
  /** @internal */
22
23
  export declare function _messageMediaFromTl(peers: PeersIndex | null, m: tl.TypeMessageMedia): MessageMedia;
@@ -8,6 +8,7 @@ const document_utils_js_1 = require("../media/document-utils.js");
8
8
  const game_js_1 = require("../media/game.js");
9
9
  const invoice_js_1 = require("../media/invoice.js");
10
10
  const location_js_1 = require("../media/location.js");
11
+ const paid_media_js_1 = require("../media/paid-media.js");
11
12
  const photo_js_1 = require("../media/photo.js");
12
13
  const poll_js_1 = require("../media/poll.js");
13
14
  const story_js_1 = require("../media/story.js");
@@ -64,6 +65,15 @@ function _messageMediaFromTl(peers, m) {
64
65
  }
65
66
  return new story_js_1.MediaStory(m, peers);
66
67
  }
68
+ case 'messageMediaPaidMedia': {
69
+ const extended = [];
70
+ m.extendedMedia.forEach((e) => {
71
+ if (e._ !== 'messageExtendedMedia')
72
+ return;
73
+ extended.push(_messageMediaFromTl(peers, e.media));
74
+ });
75
+ return new paid_media_js_1.PaidMedia(m, extended);
76
+ }
67
77
  default:
68
78
  return null;
69
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"message-media.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-media.ts"],"names":[],"mappings":";;;AAEA,wDAA+D;AAE/D,oDAA6C;AAC7C,8CAAuC;AAEvC,kEAA0D;AAC1D,8CAAuC;AACvC,oDAA6C;AAC7C,sDAA6D;AAC7D,gDAAyC;AACzC,8CAAuC;AAEvC,gDAA8C;AAC9C,gDAAyC;AAGzC,sDAA8C;AAwB9C,8CAA8C;AAE9C,gBAAgB;AAChB,SAAgB,mBAAmB,CAAC,KAAwB,EAAE,CAAsB;IAChF,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QACV,KAAK,mBAAmB;YACpB,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;gBAAE,OAAO,IAAI,CAAA;YAE1C,OAAO,IAAI,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,CAAA;YACjG,CAAC;YAED,OAAO,IAAI,cAAI,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;QAC7C,KAAK,qBAAqB,CAAC,CAAC,CAAC;YACzB,MAAM,QAAQ,GACV,CAAC,CAAC,aAAa,EAAE,CAAC,KAAK,sBAAsB,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;YAE5G,OAAO,IAAI,oBAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;QACnC,CAAC;QACD,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,4CAA4C;gBAC5C,qCAAqC;gBACrC,MAAM,IAAI,gCAAoB,CAAC,wCAAwC,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;YAClG,CAAC;YAED,OAAO,IAAI,qBAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QACnC,CAAC;QACD;YACI,OAAO,IAAI,CAAA;IACnB,CAAC;AACL,CAAC;AAxDD,kDAwDC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtTypeAssertionError } from '../../../types/errors.js'\nimport { Audio } from '../media/audio.js'\nimport { Contact } from '../media/contact.js'\nimport { Dice } from '../media/dice.js'\nimport { Document } from '../media/document.js'\nimport { parseDocument } from '../media/document-utils.js'\nimport { Game } from '../media/game.js'\nimport { Invoice } from '../media/invoice.js'\nimport { LiveLocation, Location } from '../media/location.js'\nimport { Photo } from '../media/photo.js'\nimport { Poll } from '../media/poll.js'\nimport { Sticker } from '../media/sticker.js'\nimport { MediaStory } from '../media/story.js'\nimport { Venue } from '../media/venue.js'\nimport { Video } from '../media/video.js'\nimport { Voice } from '../media/voice.js'\nimport { WebPage } from '../media/web-page.js'\nimport { PeersIndex } from '../peers/peers-index.js'\n\n/** A media inside of a {@link Message} */\nexport type MessageMedia =\n | Photo\n | Dice\n | Contact\n | Audio\n | Voice\n | Sticker\n | Document\n | Video\n | Location\n | LiveLocation\n | Game\n | WebPage\n | Venue\n | Poll\n | Invoice\n | MediaStory\n | null\nexport type MessageMediaType = Exclude<MessageMedia, null>['type']\n\n// todo: successful_payment, connected_website\n\n/** @internal */\nexport function _messageMediaFromTl(peers: PeersIndex | null, m: tl.TypeMessageMedia): MessageMedia {\n switch (m._) {\n case 'messageMediaPhoto':\n if (!(m.photo?._ === 'photo')) return null\n\n return new Photo(m.photo, m)\n case 'messageMediaDice':\n return new Dice(m)\n case 'messageMediaContact':\n return new Contact(m)\n case 'messageMediaDocument':\n if (!(m.document?._ === 'document')) return null\n\n return parseDocument(m.document, m)\n case 'messageMediaGeo':\n if (!(m.geo._ === 'geoPoint')) return null\n\n return new Location(m.geo)\n case 'messageMediaGeoLive':\n if (!(m.geo._ === 'geoPoint')) return null\n\n return new LiveLocation(m)\n case 'messageMediaGame':\n return new Game(m.game)\n case 'messageMediaWebPage':\n if (!(m.webpage._ === 'webPage')) return null\n\n return new WebPage(m.webpage)\n case 'messageMediaVenue':\n return new Venue(m)\n case 'messageMediaPoll':\n if (!peers) {\n // should only be possible in extended media\n // (and afaik polls can't be there)\n throw new MtTypeAssertionError(\"can't create poll without peers index\", 'PeersIndex', 'null')\n }\n\n return new Poll(m.poll, peers, m.results)\n case 'messageMediaInvoice': {\n const extended =\n m.extendedMedia?._ === 'messageExtendedMedia' ? _messageMediaFromTl(peers, m.extendedMedia.media) : null\n\n return new Invoice(m, extended)\n }\n case 'messageMediaStory': {\n if (!peers) {\n // should only be possible in extended media\n // (and afaik stories can't be there)\n throw new MtTypeAssertionError(\"can't create story without peers index\", 'PeersIndex', 'null')\n }\n\n return new MediaStory(m, peers)\n }\n default:\n return null\n }\n}\n"]}
1
+ {"version":3,"file":"message-media.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-media.ts"],"names":[],"mappings":";;;AAEA,wD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C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC1B,IAAI,CAAC,CAAC,CAAC,KAAK,sBAAsB;oBAAE,OAAM;gBAE1C,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;YACtD,CAAC,CAAC,CAAA;YAEF,OAAO,IAAI,yBAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;QACrC,CAAC;QACD;YACI,OAAO,IAAI,CAAA;IACnB,CAAC;AACL,CAAC;AAnED,kDAmEC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtTypeAssertionError } from '../../../types/errors.js'\nimport { Audio } from '../media/audio.js'\nimport { Contact } from '../media/contact.js'\nimport { Dice } from '../media/dice.js'\nimport { Document } from '../media/document.js'\nimport { parseDocument } from '../media/document-utils.js'\nimport { Game } from '../media/game.js'\nimport { Invoice } from '../media/invoice.js'\nimport { LiveLocation, Location } from '../media/location.js'\nimport { PaidMedia } from '../media/paid-media.js'\nimport { Photo } from '../media/photo.js'\nimport { Poll } from '../media/poll.js'\nimport { Sticker } from '../media/sticker.js'\nimport { MediaStory } from '../media/story.js'\nimport { Venue } from '../media/venue.js'\nimport { Video } from '../media/video.js'\nimport { Voice } from '../media/voice.js'\nimport { WebPage } from '../media/web-page.js'\nimport { PeersIndex } from '../peers/peers-index.js'\n\n/** A media inside of a {@link Message} */\nexport type MessageMedia =\n | Photo\n | Dice\n | Contact\n | Audio\n | Voice\n | Sticker\n | Document\n | Video\n | Location\n | LiveLocation\n | Game\n | WebPage\n | Venue\n | Poll\n | Invoice\n | MediaStory\n | PaidMedia\n | null\nexport type MessageMediaType = Exclude<MessageMedia, null>['type']\n\n// todo: successful_payment, connected_website\n\n/** @internal */\nexport function _messageMediaFromTl(peers: PeersIndex | null, m: tl.TypeMessageMedia): MessageMedia {\n switch (m._) {\n case 'messageMediaPhoto':\n if (!(m.photo?._ === 'photo')) return null\n\n return new Photo(m.photo, m)\n case 'messageMediaDice':\n return new Dice(m)\n case 'messageMediaContact':\n return new Contact(m)\n case 'messageMediaDocument':\n if (!(m.document?._ === 'document')) return null\n\n return parseDocument(m.document, m)\n case 'messageMediaGeo':\n if (!(m.geo._ === 'geoPoint')) return null\n\n return new Location(m.geo)\n case 'messageMediaGeoLive':\n if (!(m.geo._ === 'geoPoint')) return null\n\n return new LiveLocation(m)\n case 'messageMediaGame':\n return new Game(m.game)\n case 'messageMediaWebPage':\n if (!(m.webpage._ === 'webPage')) return null\n\n return new WebPage(m.webpage)\n case 'messageMediaVenue':\n return new Venue(m)\n case 'messageMediaPoll':\n if (!peers) {\n // should only be possible in extended media\n // (and afaik polls can't be there)\n throw new MtTypeAssertionError(\"can't create poll without peers index\", 'PeersIndex', 'null')\n }\n\n return new Poll(m.poll, peers, m.results)\n case 'messageMediaInvoice': {\n const extended =\n m.extendedMedia?._ === 'messageExtendedMedia' ? _messageMediaFromTl(peers, m.extendedMedia.media) : null\n\n return new Invoice(m, extended)\n }\n case 'messageMediaStory': {\n if (!peers) {\n // should only be possible in extended media\n // (and afaik stories can't be there)\n throw new MtTypeAssertionError(\"can't create story without peers index\", 'PeersIndex', 'null')\n }\n\n return new MediaStory(m, peers)\n }\n case 'messageMediaPaidMedia': {\n const extended: MessageMedia[] = []\n\n m.extendedMedia.forEach((e) => {\n if (e._ !== 'messageExtendedMedia') return\n\n extended.push(_messageMediaFromTl(peers, e.media))\n })\n\n return new PaidMedia(m, extended)\n }\n default:\n return null\n }\n}\n"]}
@@ -3,8 +3,9 @@ import { PeersIndex } from '../../peers/index.js';
3
3
  import { StoryInteractiveChannelPost } from './channel-post.js';
4
4
  import { StoryInteractiveLocation } from './location.js';
5
5
  import { StoryInteractiveReaction } from './reaction.js';
6
+ import { StoryInteractiveUrl } from './url.js';
6
7
  import { StoryInteractiveVenue } from './venue.js';
7
8
  export * from './input.js';
8
- export { StoryInteractiveChannelPost, StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveVenue };
9
- export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue | StoryInteractiveChannelPost;
9
+ export { StoryInteractiveChannelPost, StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveUrl, StoryInteractiveVenue, };
10
+ export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue | StoryInteractiveChannelPost | StoryInteractiveUrl;
10
11
  export declare function _storyInteractiveElementFromTl(raw: tl.TypeMediaArea, peers: PeersIndex): StoryInteractiveElement;
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports._storyInteractiveElementFromTl = exports.StoryInteractiveVenue = exports.StoryInteractiveReaction = exports.StoryInteractiveLocation = exports.StoryInteractiveChannelPost = void 0;
17
+ exports._storyInteractiveElementFromTl = exports.StoryInteractiveVenue = exports.StoryInteractiveUrl = exports.StoryInteractiveReaction = exports.StoryInteractiveLocation = exports.StoryInteractiveChannelPost = void 0;
18
18
  const errors_js_1 = require("../../../../types/errors.js");
19
19
  const channel_post_js_1 = require("./channel-post.js");
20
20
  Object.defineProperty(exports, "StoryInteractiveChannelPost", { enumerable: true, get: function () { return channel_post_js_1.StoryInteractiveChannelPost; } });
@@ -22,6 +22,8 @@ const location_js_1 = require("./location.js");
22
22
  Object.defineProperty(exports, "StoryInteractiveLocation", { enumerable: true, get: function () { return location_js_1.StoryInteractiveLocation; } });
23
23
  const reaction_js_1 = require("./reaction.js");
24
24
  Object.defineProperty(exports, "StoryInteractiveReaction", { enumerable: true, get: function () { return reaction_js_1.StoryInteractiveReaction; } });
25
+ const url_js_1 = require("./url.js");
26
+ Object.defineProperty(exports, "StoryInteractiveUrl", { enumerable: true, get: function () { return url_js_1.StoryInteractiveUrl; } });
25
27
  const venue_js_1 = require("./venue.js");
26
28
  Object.defineProperty(exports, "StoryInteractiveVenue", { enumerable: true, get: function () { return venue_js_1.StoryInteractiveVenue; } });
27
29
  __exportStar(require("./input.js"), exports);
@@ -35,6 +37,8 @@ function _storyInteractiveElementFromTl(raw, peers) {
35
37
  return new venue_js_1.StoryInteractiveVenue(raw);
36
38
  case 'mediaAreaChannelPost':
37
39
  return new channel_post_js_1.StoryInteractiveChannelPost(raw, peers);
40
+ case 'mediaAreaUrl':
41
+ return new url_js_1.StoryInteractiveUrl(raw);
38
42
  case 'inputMediaAreaVenue':
39
43
  case 'inputMediaAreaChannelPost':
40
44
  throw new errors_js_1.MtTypeAssertionError('StoryInteractiveElement', '!input*', raw._);