@mtcute/dispatcher 0.16.7 → 0.16.9

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 (237) hide show
  1. package/{cjs/callback-data-builder.d.ts → callback-data-builder.d.ts} +2 -2
  2. package/callback-data-builder.test.d.ts +1 -0
  3. package/{esm/context → context}/base.d.ts +2 -2
  4. package/{esm/context → context}/business-message.d.ts +5 -6
  5. package/{esm/context → context}/callback-query.d.ts +6 -7
  6. package/{cjs/context → context}/chat-join-request.d.ts +3 -3
  7. package/{esm/context → context}/chosen-inline-result.d.ts +3 -3
  8. package/{esm/context → context}/inline-query.d.ts +4 -5
  9. package/{esm/context → context}/message.d.ts +5 -6
  10. package/{cjs/context → context}/parse.d.ts +3 -3
  11. package/{esm/context → context}/pre-checkout-query.d.ts +3 -3
  12. package/{esm/context → context}/scene-transition.d.ts +1 -1
  13. package/{cjs/dispatcher.d.ts → dispatcher.d.ts} +9 -10
  14. package/{cjs/filters → filters}/bots.d.ts +4 -4
  15. package/filters/bots.test.d.ts +1 -0
  16. package/{cjs/filters → filters}/chat.d.ts +3 -3
  17. package/{esm/filters → filters}/group.d.ts +4 -4
  18. package/{cjs/filters → filters}/logic.d.ts +1 -1
  19. package/filters/logic.test.d.ts +1 -0
  20. package/{cjs/filters → filters}/message.d.ts +4 -5
  21. package/{cjs/filters → filters}/state.d.ts +2 -2
  22. package/{esm/filters → filters}/text.d.ts +3 -3
  23. package/{cjs/filters → filters}/types.d.ts +2 -2
  24. package/{cjs/filters → filters}/updates.d.ts +2 -2
  25. package/{cjs/filters → filters}/user.d.ts +3 -4
  26. package/{cjs/handler.d.ts → handler.d.ts} +5 -5
  27. package/index.cjs +2510 -0
  28. package/index.d.ts +8 -1
  29. package/index.js +2505 -1
  30. package/package.json +28 -24
  31. package/{cjs/state → state}/key.d.ts +3 -3
  32. package/state/provider.d.ts +5 -0
  33. package/{cjs/state → state}/providers/memory.d.ts +3 -4
  34. package/{esm/state → state}/providers/sqlite.d.ts +3 -3
  35. package/{cjs/state → state}/repository.d.ts +1 -1
  36. package/{esm/state → state}/service.d.ts +2 -2
  37. package/{cjs/state → state}/update-state.d.ts +2 -2
  38. package/{esm/wizard.d.ts → wizard.d.ts} +5 -6
  39. package/cjs/callback-data-builder.js +0 -141
  40. package/cjs/callback-data-builder.js.map +0 -1
  41. package/cjs/context/base.d.ts +0 -9
  42. package/cjs/context/base.js +0 -3
  43. package/cjs/context/base.js.map +0 -1
  44. package/cjs/context/business-message.d.ts +0 -61
  45. package/cjs/context/business-message.js +0 -146
  46. package/cjs/context/business-message.js.map +0 -1
  47. package/cjs/context/callback-query.d.ts +0 -63
  48. package/cjs/context/callback-query.js +0 -109
  49. package/cjs/context/callback-query.js.map +0 -1
  50. package/cjs/context/chat-join-request.js +0 -35
  51. package/cjs/context/chat-join-request.js.map +0 -1
  52. package/cjs/context/chosen-inline-result.d.ts +0 -22
  53. package/cjs/context/chosen-inline-result.js +0 -36
  54. package/cjs/context/chosen-inline-result.js.map +0 -1
  55. package/cjs/context/index.js +0 -25
  56. package/cjs/context/index.js.map +0 -1
  57. package/cjs/context/inline-query.d.ts +0 -16
  58. package/cjs/context/inline-query.js +0 -23
  59. package/cjs/context/inline-query.js.map +0 -1
  60. package/cjs/context/message.d.ts +0 -77
  61. package/cjs/context/message.js +0 -171
  62. package/cjs/context/message.js.map +0 -1
  63. package/cjs/context/parse.js +0 -42
  64. package/cjs/context/parse.js.map +0 -1
  65. package/cjs/context/pre-checkout-query.d.ts +0 -17
  66. package/cjs/context/pre-checkout-query.js +0 -27
  67. package/cjs/context/pre-checkout-query.js.map +0 -1
  68. package/cjs/context/scene-transition.d.ts +0 -24
  69. package/cjs/context/scene-transition.js +0 -52
  70. package/cjs/context/scene-transition.js.map +0 -1
  71. package/cjs/dispatcher.js +0 -908
  72. package/cjs/dispatcher.js.map +0 -1
  73. package/cjs/filters/bots.js +0 -135
  74. package/cjs/filters/bots.js.map +0 -1
  75. package/cjs/filters/bundle.js +0 -27
  76. package/cjs/filters/bundle.js.map +0 -1
  77. package/cjs/filters/chat.js +0 -56
  78. package/cjs/filters/chat.js.map +0 -1
  79. package/cjs/filters/group.d.ts +0 -26
  80. package/cjs/filters/group.js +0 -69
  81. package/cjs/filters/group.js.map +0 -1
  82. package/cjs/filters/index.js +0 -29
  83. package/cjs/filters/index.js.map +0 -1
  84. package/cjs/filters/logic.js +0 -112
  85. package/cjs/filters/logic.js.map +0 -1
  86. package/cjs/filters/message.js +0 -191
  87. package/cjs/filters/message.js.map +0 -1
  88. package/cjs/filters/state.js +0 -33
  89. package/cjs/filters/state.js.map +0 -1
  90. package/cjs/filters/text.d.ts +0 -64
  91. package/cjs/filters/text.js +0 -136
  92. package/cjs/filters/text.js.map +0 -1
  93. package/cjs/filters/types.js +0 -3
  94. package/cjs/filters/types.js.map +0 -1
  95. package/cjs/filters/updates.js +0 -40
  96. package/cjs/filters/updates.js.map +0 -1
  97. package/cjs/filters/user.js +0 -77
  98. package/cjs/filters/user.js.map +0 -1
  99. package/cjs/handler.js +0 -4
  100. package/cjs/handler.js.map +0 -1
  101. package/cjs/index.js +0 -31
  102. package/cjs/index.js.map +0 -1
  103. package/cjs/package.json +0 -3
  104. package/cjs/propagation.js +0 -27
  105. package/cjs/propagation.js.map +0 -1
  106. package/cjs/state/index.js +0 -22
  107. package/cjs/state/index.js.map +0 -1
  108. package/cjs/state/key.js +0 -43
  109. package/cjs/state/key.js.map +0 -1
  110. package/cjs/state/provider.d.ts +0 -5
  111. package/cjs/state/provider.js +0 -3
  112. package/cjs/state/provider.js.map +0 -1
  113. package/cjs/state/providers/index.js +0 -19
  114. package/cjs/state/providers/index.js.map +0 -1
  115. package/cjs/state/providers/memory.js +0 -81
  116. package/cjs/state/providers/memory.js.map +0 -1
  117. package/cjs/state/providers/sqlite.d.ts +0 -28
  118. package/cjs/state/providers/sqlite.js +0 -100
  119. package/cjs/state/providers/sqlite.js.map +0 -1
  120. package/cjs/state/repository.js +0 -3
  121. package/cjs/state/repository.js.map +0 -1
  122. package/cjs/state/service.d.ts +0 -20
  123. package/cjs/state/service.js +0 -70
  124. package/cjs/state/service.js.map +0 -1
  125. package/cjs/state/update-state.js +0 -219
  126. package/cjs/state/update-state.js.map +0 -1
  127. package/cjs/wizard.d.ts +0 -65
  128. package/cjs/wizard.js +0 -105
  129. package/cjs/wizard.js.map +0 -1
  130. package/esm/callback-data-builder.d.ts +0 -49
  131. package/esm/callback-data-builder.js +0 -137
  132. package/esm/callback-data-builder.js.map +0 -1
  133. package/esm/context/base.js +0 -2
  134. package/esm/context/base.js.map +0 -1
  135. package/esm/context/business-message.js +0 -142
  136. package/esm/context/business-message.js.map +0 -1
  137. package/esm/context/callback-query.js +0 -103
  138. package/esm/context/callback-query.js.map +0 -1
  139. package/esm/context/chat-join-request.d.ts +0 -17
  140. package/esm/context/chat-join-request.js +0 -31
  141. package/esm/context/chat-join-request.js.map +0 -1
  142. package/esm/context/chosen-inline-result.js +0 -32
  143. package/esm/context/chosen-inline-result.js.map +0 -1
  144. package/esm/context/index.d.ts +0 -9
  145. package/esm/context/index.js +0 -9
  146. package/esm/context/index.js.map +0 -1
  147. package/esm/context/inline-query.js +0 -19
  148. package/esm/context/inline-query.js.map +0 -1
  149. package/esm/context/message.js +0 -167
  150. package/esm/context/message.js.map +0 -1
  151. package/esm/context/parse.d.ts +0 -13
  152. package/esm/context/parse.js +0 -39
  153. package/esm/context/parse.js.map +0 -1
  154. package/esm/context/pre-checkout-query.js +0 -23
  155. package/esm/context/pre-checkout-query.js.map +0 -1
  156. package/esm/context/scene-transition.js +0 -48
  157. package/esm/context/scene-transition.js.map +0 -1
  158. package/esm/dispatcher.d.ts +0 -881
  159. package/esm/dispatcher.js +0 -904
  160. package/esm/dispatcher.js.map +0 -1
  161. package/esm/filters/bots.d.ts +0 -64
  162. package/esm/filters/bots.js +0 -131
  163. package/esm/filters/bots.js.map +0 -1
  164. package/esm/filters/bundle.d.ts +0 -10
  165. package/esm/filters/bundle.js +0 -11
  166. package/esm/filters/bundle.js.map +0 -1
  167. package/esm/filters/chat.d.ts +0 -27
  168. package/esm/filters/chat.js +0 -51
  169. package/esm/filters/chat.js.map +0 -1
  170. package/esm/filters/group.js +0 -65
  171. package/esm/filters/group.js.map +0 -1
  172. package/esm/filters/index.d.ts +0 -4
  173. package/esm/filters/index.js +0 -3
  174. package/esm/filters/index.js.map +0 -1
  175. package/esm/filters/logic.d.ts +0 -29
  176. package/esm/filters/logic.js +0 -105
  177. package/esm/filters/logic.js.map +0 -1
  178. package/esm/filters/message.d.ts +0 -215
  179. package/esm/filters/message.js +0 -168
  180. package/esm/filters/message.js.map +0 -1
  181. package/esm/filters/state.d.ts +0 -15
  182. package/esm/filters/state.js +0 -28
  183. package/esm/filters/state.js.map +0 -1
  184. package/esm/filters/text.js +0 -129
  185. package/esm/filters/text.js.map +0 -1
  186. package/esm/filters/types.d.ts +0 -91
  187. package/esm/filters/types.js +0 -2
  188. package/esm/filters/types.js.map +0 -1
  189. package/esm/filters/updates.d.ts +0 -39
  190. package/esm/filters/updates.js +0 -34
  191. package/esm/filters/updates.js.map +0 -1
  192. package/esm/filters/user.d.ts +0 -25
  193. package/esm/filters/user.js +0 -71
  194. package/esm/filters/user.js.map +0 -1
  195. package/esm/handler.d.ts +0 -41
  196. package/esm/handler.js +0 -3
  197. package/esm/handler.js.map +0 -1
  198. package/esm/index.d.ts +0 -8
  199. package/esm/index.js +0 -9
  200. package/esm/index.js.map +0 -1
  201. package/esm/propagation.d.ts +0 -22
  202. package/esm/propagation.js +0 -24
  203. package/esm/propagation.js.map +0 -1
  204. package/esm/state/index.d.ts +0 -5
  205. package/esm/state/index.js +0 -6
  206. package/esm/state/index.js.map +0 -1
  207. package/esm/state/key.d.ts +0 -24
  208. package/esm/state/key.js +0 -39
  209. package/esm/state/key.js.map +0 -1
  210. package/esm/state/provider.d.ts +0 -5
  211. package/esm/state/provider.js +0 -2
  212. package/esm/state/provider.js.map +0 -1
  213. package/esm/state/providers/index.d.ts +0 -2
  214. package/esm/state/providers/index.js +0 -3
  215. package/esm/state/providers/index.js.map +0 -1
  216. package/esm/state/providers/memory.d.ts +0 -30
  217. package/esm/state/providers/memory.js +0 -77
  218. package/esm/state/providers/memory.js.map +0 -1
  219. package/esm/state/providers/sqlite.js +0 -96
  220. package/esm/state/providers/sqlite.js.map +0 -1
  221. package/esm/state/repository.d.ts +0 -62
  222. package/esm/state/repository.js +0 -2
  223. package/esm/state/repository.js.map +0 -1
  224. package/esm/state/service.js +0 -66
  225. package/esm/state/service.js.map +0 -1
  226. package/esm/state/update-state.d.ts +0 -151
  227. package/esm/state/update-state.js +0 -214
  228. package/esm/state/update-state.js.map +0 -1
  229. package/esm/wizard.js +0 -101
  230. package/esm/wizard.js.map +0 -1
  231. /package/{cjs/context → context}/index.d.ts +0 -0
  232. /package/{cjs/filters → filters}/bundle.d.ts +0 -0
  233. /package/{cjs/filters → filters}/index.d.ts +0 -0
  234. /package/{cjs/index.d.ts → index.d.cts} +0 -0
  235. /package/{cjs/propagation.d.ts → propagation.d.ts} +0 -0
  236. /package/{cjs/state → state}/index.d.ts +0 -0
  237. /package/{cjs/state → state}/providers/index.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/filters/message.ts"],"names":[],"mappings":"AA4BA,OAAO,EACH,WAAW,EACX,WAAW,GACd,MAAM,cAAc,CAAA;AAOrB;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiD,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAA;AAE5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAgD,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAA;AAE1F;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAiD,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAA;AAE7F;;GAEG;AACH,MAAM,CAAC,MAAM,KAA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ction,\n MessageMediaType,\n Peer,\n Photo,\n Poll,\n RepliedMessageInfo,\n RepliedMessageOrigin,\n Sticker,\n StickerSourceType,\n StickerType,\n User,\n Venue,\n Video,\n Voice,\n WebPage,\n _RepliedMessageAssertionsByOrigin,\n} from '@mtcute/core'\nimport {\n RawDocument,\n RawLocation,\n} from '@mtcute/core'\n\nimport type { BusinessMessageContext } from '../context/business-message.js'\nimport type { MessageContext } from '../index.js'\n\nimport type { Modify, UpdateFilter } from './types.js'\n\n/**\n * Filter incoming messages.\n *\n * Messages sent to yourself (i.e. Saved Messages) are also \"incoming\"\n */\nexport const incoming: UpdateFilter<Message, { isOutgoing: false }> = msg => !msg.isOutgoing\n\n/**\n * Filter outgoing messages.\n *\n * Messages sent to yourself (i.e. Saved Messages) are **not** \"outgoing\"\n */\nexport const outgoing: UpdateFilter<Message, { isOutgoing: true }> = msg => msg.isOutgoing\n\n/**\n * Filter for scheduled messages\n */\nexport const scheduled: UpdateFilter<Message, { isScheduled: true }> = msg => msg.isScheduled\n\n/**\n * Filter messages that are replies to some other message\n */\nexport const reply: UpdateFilter<Message, { replyToMessage: RepliedMessageInfo }> = msg => msg.replyToMessage !== null\n\n/**\n * Filter messages that are replies with the given origin type\n */\nexport function replyOrigin<T extends RepliedMessageOrigin>(origin: T): UpdateFilter<\n Message,\n {\n replyToMessage: Modify<RepliedMessageInfo, _RepliedMessageAssertionsByOrigin[T] & { origin: T }>\n }\n> {\n return msg =>\n msg.replyToMessage?.originIs(origin) ?? false\n} // originIs does additional checks\n\n/**\n * Filter messages containing some media\n */\nexport const media: UpdateFilter<Message, { media: Exclude<Message['media'], null> }> = msg => msg.media !== null\n\n/**\n * Filter messages containing media of given type\n */\nexport function mediaOf<T extends MessageMediaType>(type: T): UpdateFilter<\n Message,\n { media: Extract<Message['media'], { type: T }> }\n> {\n return msg =>\n msg.media?.type === type\n}\n\n/** Filter messages containing a photo */\nexport const photo: UpdateFilter<Message, { media: Photo }> = mediaOf('photo')\n/** Filter messages containing a dice */\nexport const dice: UpdateFilter<Message, { media: Dice }> = mediaOf('dice')\n/** Filter messages containing a contact */\nexport const contact: UpdateFilter<Message, { media: Contact }> = mediaOf('contact')\n/** Filter messages containing an audio file */\nexport const audio: UpdateFilter<Message, { media: Audio }> = mediaOf('audio')\n/** Filter messages containing a voice message (audio-only) */\nexport const voice: UpdateFilter<Message, { media: Voice }> = mediaOf('voice')\n/** Filter messages containing a sticker */\nexport const sticker: UpdateFilter<Message, { media: Sticker }> = mediaOf('sticker')\n/** Filter messages containing a document (a file) */\nexport const document: UpdateFilter<Message, { media: Document }> = mediaOf('document')\n/** Filter messages containing any video (videos, round messages and animations) */\nexport const anyVideo: UpdateFilter<Message, { media: Video }> = mediaOf('video')\n/** Filter messages containing a static location */\nexport const location: UpdateFilter<Message, { media: Location }> = mediaOf('location')\n/** Filter messages containing a live location */\nexport const liveLocation: UpdateFilter<Message, { media: LiveLocation }> = mediaOf('live_location')\n/** Filter messages containing a game */\nexport const game: UpdateFilter<Message, { media: Game }> = mediaOf('game')\n/** Filter messages containing a web page */\nexport const webpage: UpdateFilter<Message, { media: WebPage }> = mediaOf('webpage')\n/** Filter messages containing a venue */\nexport const venue: UpdateFilter<Message, { media: Venue }> = mediaOf('venue')\n/** Filter messages containing a poll */\nexport const poll: UpdateFilter<Message, { media: Poll }> = mediaOf('poll')\n/** Filter messages containing an invoice */\nexport const invoice: UpdateFilter<Message, { media: Invoice }> = mediaOf('invoice')\n\n/**\n * Filter messages containing any location (live or static).\n */\nexport const anyLocation: UpdateFilter<Message, { media: Location }> = msg => msg.media instanceof RawLocation\n\n/**\n * Filter messages containing a document\n *\n * This will also match media like audio, video, voice\n * that also use Documents\n */\nexport const anyDocument: UpdateFilter<Message, { media: RawDocument }> = msg => msg.media instanceof RawDocument\n\n/**\n * Filter messages containing a simple video.\n *\n * This does not include round messages and animations\n */\nexport const video: UpdateFilter<\n Message,\n {\n media: Modify<\n Video,\n {\n isRound: false\n isAnimation: false\n }\n >\n }\n> = msg => msg.media?.type === 'video' && !msg.media.isAnimation && !msg.media.isRound\n\n/**\n * Filter messages containing an animation.\n *\n * > **Note**: Legacy GIFs (i.e. documents with `image/gif` MIME)\n * > are also considered animations.\n */\nexport const animation: UpdateFilter<\n Message,\n {\n media: Modify<\n Video,\n {\n isRound: false\n isAnimation: true\n }\n >\n }\n> = msg => msg.media?.type === 'video' && msg.media.isAnimation && !msg.media.isRound\n\n/**\n * Filter messages containing a round message (aka video note).\n */\nexport const roundMessage: UpdateFilter<\n Message,\n {\n media: Modify<\n Video,\n {\n isRound: true\n isAnimation: false\n }\n >\n }\n> = msg => msg.media?.type === 'video' && !msg.media.isAnimation && msg.media.isRound\n\n/**\n * Filter messages containing a sticker by its type\n */\nexport function stickerByType(type: StickerType): UpdateFilter<Message, { media: Sticker }> {\n return msg =>\n msg.media?.type === 'sticker' && msg.media.stickerType === type\n}\n\n/**\n * Filter messages containing a sticker by its source file type\n */\nexport function stickerBySourceType(type: StickerSourceType): UpdateFilter<Message, { media: Sticker }> {\n return msg =>\n msg.media?.type === 'sticker' && msg.media.sourceType === type\n}\n\n/**\n * Filter text-only messages non-service messages\n */\nexport const text: UpdateFilter<\n Message,\n {\n media: null\n isService: false\n }\n> = msg => msg.media === null && !msg.isService\n\n/**\n * Filter service messages\n */\nexport const service: UpdateFilter<Message, { isService: true }> = msg => msg.isService\n\n/**\n * Filter service messages by action type\n */\nexport function action<T extends Exclude<MessageAction, null>['type']>(type: MaybeArray<T>): UpdateFilter<\n Message,\n {\n action: Extract<MessageAction, { type: T }>\n sender: T extends 'user_joined_link' | 'user_removed' | 'history_cleared' | 'contact_joined' | 'bot_allowed'\n ? User\n : Peer\n }\n> {\n if (Array.isArray(type)) {\n const index: Partial<Record<T, true>> = {}\n type.forEach(it => (index[it] = true))\n\n return msg => (msg.action?.type as any) in index\n }\n\n return msg => msg.action?.type === type\n}\n\nexport function sender<T extends Message['sender']['type']>(type: T): UpdateFilter<\n Message,\n { sender: Extract<Message['sender'], { type: T }> }\n> {\n return msg =>\n msg.sender.type === type\n}\n\n/**\n * Filter that matches messages that are replies to some other message that can be fetched\n * (i.e. not `private` origin, and has not been deleted)\n *\n * Optionally, you can pass a filter that will be applied to the replied message.\n */\nexport function replyTo<Mod, State extends object>(\n filter?: UpdateFilter<Message, Mod, State>,\n): UpdateFilter<\n MessageContext | BusinessMessageContext,\n { getReplyTo: () => Promise<Message & Mod> },\n State\n > {\n return async (msg, state) => {\n if (!msg.replyToMessage?.id) return false\n\n const reply = msg._name === 'new_message' ? await msg.getReplyTo() : msg.replyTo\n if (!reply) return false\n\n if (msg._name === 'new_message') {\n msg.getReplyTo = () => Promise.resolve(reply)\n }\n\n if (!filter) return true\n\n return filter(reply, state)\n }\n}\n\n/**\n * Middleware-like filter that will fetch the sender of the message\n * and make it available to further filters, as well as the handler itself.\n */\nexport function withCompleteSender<Mod, State extends object>(\n filter?: UpdateFilter<MessageContext, Mod, State>,\n): UpdateFilter<MessageContext, Mod, State> {\n return async (msg, state) => {\n try {\n await msg.getCompleteSender()\n } catch {\n return false\n }\n\n if (!filter) return true\n\n return filter(msg, state)\n }\n}\n"]}
@@ -1,15 +0,0 @@
1
- import type { MaybePromise } from '@mtcute/core';
2
- import type { UpdateFilter } from './types.js';
3
- /**
4
- * Create a filter for the cases when the state is empty
5
- */
6
- export declare const stateEmpty: UpdateFilter<any>;
7
- /**
8
- * Create a filter based on state predicate
9
- *
10
- * If state exists and matches `predicate`, update passes
11
- * this filter, otherwise it doesn't
12
- *
13
- * @param predicate State predicate
14
- */
15
- export declare function state<T extends object>(predicate: (state: T) => MaybePromise<boolean>): UpdateFilter<any, {}, T>;
@@ -1,28 +0,0 @@
1
- /**
2
- * Create a filter for the cases when the state is empty
3
- */
4
- export const stateEmpty = async (upd, state) => {
5
- if (!state)
6
- return false;
7
- return !(await state.get());
8
- };
9
- /**
10
- * Create a filter based on state predicate
11
- *
12
- * If state exists and matches `predicate`, update passes
13
- * this filter, otherwise it doesn't
14
- *
15
- * @param predicate State predicate
16
- */
17
- // eslint-disable-next-line ts/no-empty-object-type
18
- export function state(predicate) {
19
- return async (upd, state) => {
20
- if (!state)
21
- return false;
22
- const data = await state.get();
23
- if (!data)
24
- return false;
25
- return predicate(data);
26
- };
27
- }
28
- //# sourceMappingURL=state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/filters/state.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IAC9D,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IAExB,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,mDAAmD;AACnD,MAAM,UAAU,KAAK,CAAmB,SAA8C;IAClF,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QACxB,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QACxB,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAAA;QAC9B,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;QAEvB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC,CAAA;AACL,CAAC","sourcesContent":["import type { MaybePromise } from '@mtcute/core'\n\nimport type { UpdateFilter } from './types.js'\n\n/**\n * Create a filter for the cases when the state is empty\n */\nexport const stateEmpty: UpdateFilter<any> = async (upd, state) => {\n if (!state) return false\n\n return !(await state.get())\n}\n\n/**\n * Create a filter based on state predicate\n *\n * If state exists and matches `predicate`, update passes\n * this filter, otherwise it doesn't\n *\n * @param predicate State predicate\n */\n// eslint-disable-next-line ts/no-empty-object-type\nexport function state<T extends object>(predicate: (state: T) => MaybePromise<boolean>): UpdateFilter<any, {}, T> {\n return async (upd, state) => {\n if (!state) return false\n const data = await state.get()\n if (!data) return false\n\n return predicate(data)\n }\n}\n"]}
@@ -1,129 +0,0 @@
1
- function extractText(obj) {
2
- switch (obj._name) {
3
- case 'new_message':
4
- case 'new_business_message':
5
- return obj.text;
6
- case 'inline_query':
7
- return obj.query;
8
- case 'chosen_inline_result':
9
- return obj.id;
10
- case 'callback_query':
11
- case 'inline_callback_query':
12
- case 'business_callback_query':
13
- if (obj.raw.data)
14
- return obj.dataStr;
15
- }
16
- return null;
17
- }
18
- /**
19
- * Filter objects that match a given regular expression
20
- * - for `Message`, `Message.text` is used
21
- * - for `InlineQuery`, `InlineQuery.query` is used
22
- * - for {@link ChosenInlineResult}, {@link ChosenInlineResult#id} is used
23
- * - for callback queries, `dataStr` is used
24
- *
25
- * When a regex matches, the match array is stored in a
26
- * type-safe extension field `.match` of the object
27
- *
28
- * @param regex Regex to be matched
29
- */
30
- export function regex(regex) {
31
- return (obj) => {
32
- const txt = extractText(obj);
33
- if (!txt)
34
- return false;
35
- const m = txt.match(regex);
36
- if (m) {
37
- obj.match = m;
38
- return true;
39
- }
40
- return false;
41
- };
42
- }
43
- /**
44
- * Filter objects which contain the exact text given
45
- * - for `Message`, `Message.text` is used
46
- * - for `InlineQuery`, `InlineQuery.query` is used
47
- * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used
48
- * - for callback queries, `dataStr` is used
49
- *
50
- * @param str String to be matched
51
- * @param ignoreCase Whether string case should be ignored
52
- */
53
- export function equals(str, ignoreCase = false) {
54
- if (ignoreCase) {
55
- str = str.toLowerCase();
56
- return obj => extractText(obj)?.toLowerCase() === str;
57
- }
58
- return obj => extractText(obj) === str;
59
- }
60
- /**
61
- * Filter objects which contain the text given (as a substring)
62
- * - for `Message`, `Message.text` is used
63
- * - for `InlineQuery`, `InlineQuery.query` is used
64
- * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used
65
- * - for callback queries, `dataStr` is used
66
- *
67
- * @param str Substring to be matched
68
- * @param ignoreCase Whether string case should be ignored
69
- */
70
- export function contains(str, ignoreCase = false) {
71
- if (ignoreCase) {
72
- str = str.toLowerCase();
73
- return (obj) => {
74
- const txt = extractText(obj);
75
- return txt != null && txt.toLowerCase().includes(str);
76
- };
77
- }
78
- return (obj) => {
79
- const txt = extractText(obj);
80
- return txt != null && txt.includes(str);
81
- };
82
- }
83
- /**
84
- * Filter objects which contain the text starting with a given string
85
- * - for `Message`, `Message.text` is used
86
- * - for `InlineQuery`, `InlineQuery.query` is used
87
- * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used
88
- * - for callback queries, `dataStr` is used
89
- *
90
- * @param str Substring to be matched
91
- * @param ignoreCase Whether string case should be ignored
92
- */
93
- export function startsWith(str, ignoreCase = false) {
94
- if (ignoreCase) {
95
- str = str.toLowerCase();
96
- return (obj) => {
97
- const txt = extractText(obj);
98
- return txt != null && txt.toLowerCase().substring(0, str.length) === str;
99
- };
100
- }
101
- return (obj) => {
102
- const txt = extractText(obj);
103
- return txt != null && txt.substring(0, str.length) === str;
104
- };
105
- }
106
- /**
107
- * Filter objects which contain the text ending with a given string
108
- * - for `Message`, `Message.text` is used
109
- * - for `InlineQuery`, `InlineQuery.query` is used
110
- * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used
111
- * - for callback queries, `dataStr` is used
112
- *
113
- * @param str Substring to be matched
114
- * @param ignoreCase Whether string case should be ignored
115
- */
116
- export function endsWith(str, ignoreCase = false) {
117
- if (ignoreCase) {
118
- str = str.toLowerCase();
119
- return (obj) => {
120
- const txt = extractText(obj);
121
- return txt != null && txt.toLowerCase().substring(0, str.length) === str;
122
- };
123
- }
124
- return (obj) => {
125
- const txt = extractText(obj);
126
- return txt != null && txt.substring(0, str.length) === str;
127
- };
128
- }
129
- //# sourceMappingURL=text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/filters/text.ts"],"names":[],"mappings":"AAwBA,SAAS,WAAW,CAAC,GAAoB;IACrC,QAAQ,GAAG,CAAC,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AE,UAAU,GAAG,KAAK;IACpD,IAAI,UAAU,EAAE,CAAC;QACb,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;QAEvB,OAAO,CAAC,GAAG,EAAE,EAAE;YACX,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;YAE5B,OAAO,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAA;QAC5E,CAAC,CAAA;IACL,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QAE5B,OAAO,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAA;IAC9D,CAAC,CAAA;AACL,CAAC","sourcesContent":["import type {\n BusinessCallbackQuery,\n BusinessMessage,\n CallbackQuery,\n ChosenInlineResult,\n InlineCallbackQuery,\n InlineQuery,\n Message,\n} from '@mtcute/core'\n\nimport type { UpdateContextDistributed } from '../context/base.js'\n\nimport type { UpdateFilter } from './types.js'\n\ntype UpdatesWithText = UpdateContextDistributed<\n | Message\n | BusinessMessage\n | InlineQuery\n | ChosenInlineResult\n | CallbackQuery\n | InlineCallbackQuery\n | BusinessCallbackQuery\n>\n\nfunction extractText(obj: UpdatesWithText): string | null {\n switch (obj._name) {\n case 'new_message':\n case 'new_business_message':\n return obj.text\n case 'inline_query':\n return obj.query\n case 'chosen_inline_result':\n return obj.id\n case 'callback_query':\n case 'inline_callback_query':\n case 'business_callback_query':\n if (obj.raw.data) return obj.dataStr\n }\n\n return null\n}\n\n/**\n * Filter objects that match a given regular expression\n * - for `Message`, `Message.text` is used\n * - for `InlineQuery`, `InlineQuery.query` is used\n * - for {@link ChosenInlineResult}, {@link ChosenInlineResult#id} is used\n * - for callback queries, `dataStr` is used\n *\n * When a regex matches, the match array is stored in a\n * type-safe extension field `.match` of the object\n *\n * @param regex Regex to be matched\n */\nexport function regex(regex: RegExp): UpdateFilter<UpdatesWithText, { match: RegExpMatchArray }> {\n return (obj) => {\n const txt = extractText(obj)\n if (!txt) return false\n\n const m = txt.match(regex)\n\n if (m) {\n (obj as typeof obj & { match: RegExpMatchArray }).match = m\n\n return true\n }\n\n return false\n }\n}\n\n/**\n * Filter objects which contain the exact text given\n * - for `Message`, `Message.text` is used\n * - for `InlineQuery`, `InlineQuery.query` is used\n * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used\n * - for callback queries, `dataStr` is used\n *\n * @param str String to be matched\n * @param ignoreCase Whether string case should be ignored\n */\nexport function equals(str: string, ignoreCase = false): UpdateFilter<UpdatesWithText> {\n if (ignoreCase) {\n str = str.toLowerCase()\n\n return obj => extractText(obj)?.toLowerCase() === str\n }\n\n return obj => extractText(obj) === str\n}\n\n/**\n * Filter objects which contain the text given (as a substring)\n * - for `Message`, `Message.text` is used\n * - for `InlineQuery`, `InlineQuery.query` is used\n * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used\n * - for callback queries, `dataStr` is used\n *\n * @param str Substring to be matched\n * @param ignoreCase Whether string case should be ignored\n */\nexport function contains(str: string, ignoreCase = false): UpdateFilter<UpdatesWithText> {\n if (ignoreCase) {\n str = str.toLowerCase()\n\n return (obj) => {\n const txt = extractText(obj)\n\n return txt != null && txt.toLowerCase().includes(str)\n }\n }\n\n return (obj) => {\n const txt = extractText(obj)\n\n return txt != null && txt.includes(str)\n }\n}\n\n/**\n * Filter objects which contain the text starting with a given string\n * - for `Message`, `Message.text` is used\n * - for `InlineQuery`, `InlineQuery.query` is used\n * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used\n * - for callback queries, `dataStr` is used\n *\n * @param str Substring to be matched\n * @param ignoreCase Whether string case should be ignored\n */\nexport function startsWith(str: string, ignoreCase = false): UpdateFilter<UpdatesWithText> {\n if (ignoreCase) {\n str = str.toLowerCase()\n\n return (obj) => {\n const txt = extractText(obj)\n\n return txt != null && txt.toLowerCase().substring(0, str.length) === str\n }\n }\n\n return (obj) => {\n const txt = extractText(obj)\n\n return txt != null && txt.substring(0, str.length) === str\n }\n}\n\n/**\n * Filter objects which contain the text ending with a given string\n * - for `Message`, `Message.text` is used\n * - for `InlineQuery`, `InlineQuery.query` is used\n * - for {@link ChosenInlineResult}, {@link ChosenInlineResult.id} is used\n * - for callback queries, `dataStr` is used\n *\n * @param str Substring to be matched\n * @param ignoreCase Whether string case should be ignored\n */\nexport function endsWith(str: string, ignoreCase = false): UpdateFilter<UpdatesWithText> {\n if (ignoreCase) {\n str = str.toLowerCase()\n\n return (obj) => {\n const txt = extractText(obj)\n\n return txt != null && txt.toLowerCase().substring(0, str.length) === str\n }\n }\n\n return (obj) => {\n const txt = extractText(obj)\n\n return txt != null && txt.substring(0, str.length) === str\n }\n}\n"]}
@@ -1,91 +0,0 @@
1
- import type { MaybePromise } from '@mtcute/core';
2
- import type { UpdateState } from '../state/update-state.js';
3
- /**
4
- * Type describing a primitive filter, which is a function taking some `Base`
5
- * and a {@link TelegramClient}, checking it against some condition
6
- * and returning a boolean.
7
- *
8
- * If `true` is returned, the filter is considered
9
- * to be matched, and the appropriate update handler function is called,
10
- * otherwise next registered handler is checked.
11
- *
12
- * Additionally, filter might contain a type modification
13
- * to `Base` for better code insights. If it is present,
14
- * it is used to overwrite types (!) of some of the `Base` fields
15
- * to given (note that this is entirely compile-time! object is not modified)
16
- *
17
- * For parametrized filters (like {@link filters.regex}),
18
- * type modification can also be used to add additional fields
19
- * (in case of `regex`, its match array is added to `.match`)
20
- *
21
- * Example without type mod:
22
- * ```typescript
23
- *
24
- * const hasPhoto: UpdateFilter<Message> = msg => msg.media?.type === 'photo'
25
- *
26
- * // ..later..
27
- * tg.onNewMessage(hasPhoto, async (msg) => {
28
- * // `hasPhoto` filter matched, so we can safely assume
29
- * // that `msg.media` is a Photo.
30
- * //
31
- * // but it is very redundant, verbose and error-rome,
32
- * // wonder if we could make typescript do this automagically and safely...
33
- * await (msg.media as Photo).downloadToFile(`${msg.id}.jpg`)
34
- * })
35
- * ```
36
- *
37
- * Example with type mod:
38
- * ```typescript
39
- *
40
- * const hasPhoto: UpdateFilter<Message, { media: Photo }> = msg => msg.media?.type === 'photo'
41
- *
42
- * // ..later..
43
- * tg.onNewMessage(hasPhoto, async (msg) => {
44
- * // since `hasPhoto` filter matched,
45
- * // we have applied the modification to `msg`,
46
- * // and `msg.media` now has type `Photo`
47
- * //
48
- * // no more redundancy and type casts!
49
- * await msg.media.downloadToFile(`${msg.id}.jpg`)
50
- * })
51
- * ```
52
- *
53
- * > **Note**: Type modification can contain anything, even totally unrelated types
54
- * > and it is *your* task to keep track that everything is correct.
55
- * >
56
- * > Bad example:
57
- * > ```typescript
58
- * > // we check for `Photo`, but type contains `Audio`. this will be a problem!
59
- * > const hasPhoto: UpdateFilter<Message, { media: Audio }> = msg => msg.media?.type === 'photo'
60
- * >
61
- * > // ..later..
62
- * > tg.onNewMessage(hasPhoto, async (msg) => {
63
- * > // oops! `msg.media` is `Audio` and does not have `.width`!
64
- * > console.log(msg.media.width)
65
- * > })
66
- * > ```
67
- *
68
- * > **Warning!** Do not use the generics provided in functions
69
- * > like `and`, `or`, etc. Those are meant to be inferred by the compiler!
70
- */
71
- export type UpdateFilter<Base, Mod = {}, State extends object = never> = (update: Base, state?: UpdateState<State>) => MaybePromise<boolean>;
72
- export type Modify<Base, Mod> = Omit<Base, keyof Mod> & Mod;
73
- export type Invert<Base, Mod> = {
74
- [P in keyof Mod & keyof Base]: Exclude<Base[P], Mod[P]>;
75
- };
76
- export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
77
- export type ExtractBase<Filter> = Filter extends UpdateFilter<infer I, any> ? I : never;
78
- export type ExtractMod<Filter> = Filter extends UpdateFilter<any, infer I> ? I : never;
79
- export type ExtractState<Filter> = Filter extends UpdateFilter<any, any, infer I> ? I : never;
80
- export type TupleKeys<T extends any[]> = Exclude<keyof T, keyof []>;
81
- export type WrapBase<T extends any[]> = {
82
- [K in TupleKeys<T>]: {
83
- base: ExtractBase<T[K]>;
84
- };
85
- };
86
- export type Values<T> = T[keyof T];
87
- export type UnwrapBase<T> = T extends {
88
- base: any;
89
- } ? T['base'] : never;
90
- export type ExtractBaseMany<Filters extends any[]> = UnwrapBase<UnionToIntersection<Values<WrapBase<Filters>>>>;
91
- export type EmptyObject = Record<never, never>;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/filters/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MaybePromise } from '@mtcute/core'\n\nimport type { UpdateState } from '../state/update-state.js'\n/**\n * Type describing a primitive filter, which is a function taking some `Base`\n * and a {@link TelegramClient}, checking it against some condition\n * and returning a boolean.\n *\n * If `true` is returned, the filter is considered\n * to be matched, and the appropriate update handler function is called,\n * otherwise next registered handler is checked.\n *\n * Additionally, filter might contain a type modification\n * to `Base` for better code insights. If it is present,\n * it is used to overwrite types (!) of some of the `Base` fields\n * to given (note that this is entirely compile-time! object is not modified)\n *\n * For parametrized filters (like {@link filters.regex}),\n * type modification can also be used to add additional fields\n * (in case of `regex`, its match array is added to `.match`)\n *\n * Example without type mod:\n * ```typescript\n *\n * const hasPhoto: UpdateFilter<Message> = msg => msg.media?.type === 'photo'\n *\n * // ..later..\n * tg.onNewMessage(hasPhoto, async (msg) => {\n * // `hasPhoto` filter matched, so we can safely assume\n * // that `msg.media` is a Photo.\n * //\n * // but it is very redundant, verbose and error-rome,\n * // wonder if we could make typescript do this automagically and safely...\n * await (msg.media as Photo).downloadToFile(`${msg.id}.jpg`)\n * })\n * ```\n *\n * Example with type mod:\n * ```typescript\n *\n * const hasPhoto: UpdateFilter<Message, { media: Photo }> = msg => msg.media?.type === 'photo'\n *\n * // ..later..\n * tg.onNewMessage(hasPhoto, async (msg) => {\n * // since `hasPhoto` filter matched,\n * // we have applied the modification to `msg`,\n * // and `msg.media` now has type `Photo`\n * //\n * // no more redundancy and type casts!\n * await msg.media.downloadToFile(`${msg.id}.jpg`)\n * })\n * ```\n *\n * > **Note**: Type modification can contain anything, even totally unrelated types\n * > and it is *your* task to keep track that everything is correct.\n * >\n * > Bad example:\n * > ```typescript\n * > // we check for `Photo`, but type contains `Audio`. this will be a problem!\n * > const hasPhoto: UpdateFilter<Message, { media: Audio }> = msg => msg.media?.type === 'photo'\n * >\n * > // ..later..\n * > tg.onNewMessage(hasPhoto, async (msg) => {\n * > // oops! `msg.media` is `Audio` and does not have `.width`!\n * > console.log(msg.media.width)\n * > })\n * > ```\n *\n * > **Warning!** Do not use the generics provided in functions\n * > like `and`, `or`, etc. Those are meant to be inferred by the compiler!\n */\n// we need the second parameter because it carries meta information\n// eslint-disable-next-line unused-imports/no-unused-vars, ts/no-empty-object-type\nexport type UpdateFilter<Base, Mod = {}, State extends object = never> = (\n update: Base,\n state?: UpdateState<State>,\n) => MaybePromise<boolean>\n\nexport type Modify<Base, Mod> = Omit<Base, keyof Mod> & Mod\nexport type Invert<Base, Mod> = {\n [P in keyof Mod & keyof Base]: Exclude<Base[P], Mod[P]>\n}\n\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never\n\nexport type ExtractBase<Filter> = Filter extends UpdateFilter<infer I, any> ? I : never\n\nexport type ExtractMod<Filter> = Filter extends UpdateFilter<any, infer I> ? I : never\n\nexport type ExtractState<Filter> = Filter extends UpdateFilter<any, any, infer I> ? I : never\n\nexport type TupleKeys<T extends any[]> = Exclude<keyof T, keyof []>\nexport type WrapBase<T extends any[]> = {\n [K in TupleKeys<T>]: { base: ExtractBase<T[K]> }\n}\nexport type Values<T> = T[keyof T]\nexport type UnwrapBase<T> = T extends { base: any } ? T['base'] : never\nexport type ExtractBaseMany<Filters extends any[]> = UnwrapBase<UnionToIntersection<Values<WrapBase<Filters>>>>\n\nexport type EmptyObject = Record<never, never>\n"]}
@@ -1,39 +0,0 @@
1
- import type { ChatMemberUpdate, ChatMemberUpdateType, UserStatus, UserStatusUpdate } from '@mtcute/core';
2
- import type { UpdateFilter } from './types.js';
3
- /**
4
- * Create a filter for {@link ChatMemberUpdate} by update type
5
- *
6
- * @param types Update type(s)
7
- * @link ChatMemberUpdate.Type
8
- */
9
- export declare const chatMember: {
10
- <T extends ChatMemberUpdateType>(type: T): UpdateFilter<ChatMemberUpdate, {
11
- type: T;
12
- }>;
13
- <T extends ChatMemberUpdateType[]>(types: T): UpdateFilter<ChatMemberUpdate, {
14
- type: T[number];
15
- }>;
16
- };
17
- /**
18
- * Create a filter for {@link UserStatusUpdate} by new user status
19
- *
20
- * @param statuses Update type(s)
21
- * @link User.Status
22
- */
23
- export declare const userStatus: {
24
- <T extends UserStatus>(status: T): UpdateFilter<UserStatusUpdate, {
25
- type: T;
26
- lastOnline: T extends 'offline' ? Date : null;
27
- nextOffline: T extends 'online' ? Date : null;
28
- }>;
29
- <T extends UserStatus[]>(statuses: T): UpdateFilter<UserStatusUpdate, {
30
- type: T[number];
31
- }>;
32
- };
33
- /**
34
- * Create a filter for {@link ChatMemberUpdate} for updates
35
- * regarding current user
36
- */
37
- export declare const chatMemberSelf: UpdateFilter<ChatMemberUpdate, {
38
- isSelf: true;
39
- }>;
@@ -1,34 +0,0 @@
1
- /**
2
- * Create a filter for {@link ChatMemberUpdate} by update type
3
- *
4
- * @param types Update type(s)
5
- * @link ChatMemberUpdate.Type
6
- */
7
- export const chatMember = (types) => {
8
- if (Array.isArray(types)) {
9
- const index = {};
10
- types.forEach(typ => (index[typ] = true));
11
- return upd => upd.type in index;
12
- }
13
- return upd => upd.type === types;
14
- };
15
- /**
16
- * Create a filter for {@link UserStatusUpdate} by new user status
17
- *
18
- * @param statuses Update type(s)
19
- * @link User.Status
20
- */
21
- export const userStatus = (statuses) => {
22
- if (Array.isArray(statuses)) {
23
- const index = {};
24
- statuses.forEach(typ => (index[typ] = true));
25
- return upd => upd.status in index;
26
- }
27
- return upd => upd.status === statuses;
28
- };
29
- /**
30
- * Create a filter for {@link ChatMemberUpdate} for updates
31
- * regarding current user
32
- */
33
- export const chatMemberSelf = upd => upd.isSelf;
34
- //# sourceMappingURL=updates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updates.js","sourceRoot":"","sources":["../../../src/filters/updates.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAGnB,CAAC,KAAuC,EAAkC,EAAE;IAC5E,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,KAAK,GAAgD,EAAE,CAAA;QAC7D,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;QAEzC,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,CAAA;IACnC,CAAC;IAED,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,CAAA;AACpC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAYnB,CAAC,QAAgC,EAAkC,EAAE;IACrE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAsC,EAAE,CAAA;QACnD,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;QAE5C,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,KAAK,CAAA;IACrC,CAAC;IAED,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAA;AACzC,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAqD,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAA","sourcesContent":["import type { ChatMemberUpdate, ChatMemberUpdateType, MaybeArray, UserStatus, UserStatusUpdate } from '@mtcute/core'\n\nimport type { UpdateFilter } from './types.js'\n\n/**\n * Create a filter for {@link ChatMemberUpdate} by update type\n *\n * @param types Update type(s)\n * @link ChatMemberUpdate.Type\n */\nexport const chatMember: {\n <T extends ChatMemberUpdateType>(type: T): UpdateFilter<ChatMemberUpdate, { type: T }>\n <T extends ChatMemberUpdateType[]>(types: T): UpdateFilter<ChatMemberUpdate, { type: T[number] }>\n} = (types: MaybeArray<ChatMemberUpdateType>): UpdateFilter<ChatMemberUpdate> => {\n if (Array.isArray(types)) {\n const index: Partial<Record<ChatMemberUpdateType, true>> = {}\n types.forEach(typ => (index[typ] = true))\n\n return upd => upd.type in index\n }\n\n return upd => upd.type === types\n}\n\n/**\n * Create a filter for {@link UserStatusUpdate} by new user status\n *\n * @param statuses Update type(s)\n * @link User.Status\n */\nexport const userStatus: {\n <T extends UserStatus>(\n status: T,\n ): UpdateFilter<\n UserStatusUpdate,\n {\n type: T\n lastOnline: T extends 'offline' ? Date : null\n nextOffline: T extends 'online' ? Date : null\n }\n >\n <T extends UserStatus[]>(statuses: T): UpdateFilter<UserStatusUpdate, { type: T[number] }>\n} = (statuses: MaybeArray<UserStatus>): UpdateFilter<UserStatusUpdate> => {\n if (Array.isArray(statuses)) {\n const index: Partial<Record<UserStatus, true>> = {}\n statuses.forEach(typ => (index[typ] = true))\n\n return upd => upd.status in index\n }\n\n return upd => upd.status === statuses\n}\n\n/**\n * Create a filter for {@link ChatMemberUpdate} for updates\n * regarding current user\n */\nexport const chatMemberSelf: UpdateFilter<ChatMemberUpdate, { isSelf: true }> = upd => upd.isSelf\n"]}
@@ -1,25 +0,0 @@
1
- import type { BotChatJoinRequestUpdate, BusinessCallbackQuery, BusinessMessage, CallbackQuery, ChatMemberUpdate, ChosenInlineResult, DeleteStoryUpdate, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, MaybeArray, Message, PollVoteUpdate, StoryUpdate, UserStatusUpdate, UserTypingUpdate } from '@mtcute/core';
2
- import { User } from '@mtcute/core';
3
- import type { UpdateContextDistributed } from '../context/base.js';
4
- import type { UpdateFilter } from './types.js';
5
- /**
6
- * Filter messages generated by yourself (including Saved Messages)
7
- */
8
- export declare const me: UpdateFilter<Message, {
9
- sender: User;
10
- }>;
11
- /**
12
- * Filter messages sent by bots
13
- */
14
- export declare const bot: UpdateFilter<Message, {
15
- sender: User;
16
- }>;
17
- /**
18
- * Filter updates by user ID(s) or username(s)
19
- *
20
- * Note that only some updates support filtering by username.
21
- */
22
- export declare const userId: {
23
- (id: MaybeArray<number>): UpdateFilter<UpdateContextDistributed<Message | BusinessMessage | StoryUpdate | DeleteStoryUpdate | InlineQuery | ChatMemberUpdate | ChosenInlineResult | CallbackQuery | InlineCallbackQuery | BusinessCallbackQuery | PollVoteUpdate | BotChatJoinRequestUpdate>>;
24
- (id: MaybeArray<number | string>): UpdateFilter<UpdateContextDistributed<Message | BusinessMessage | UserStatusUpdate | UserTypingUpdate | StoryUpdate | HistoryReadUpdate | DeleteStoryUpdate | InlineQuery | ChatMemberUpdate | ChosenInlineResult | CallbackQuery | InlineCallbackQuery | BusinessCallbackQuery | PollVoteUpdate | BotChatJoinRequestUpdate>>;
25
- };
@@ -1,71 +0,0 @@
1
- import { User, } from '@mtcute/core';
2
- /**
3
- * Filter messages generated by yourself (including Saved Messages)
4
- */
5
- export const me = msg => (msg.sender.type === 'user' && msg.sender.isSelf) || msg.isOutgoing;
6
- /**
7
- * Filter messages sent by bots
8
- */
9
- export const bot = msg => msg.sender.constructor === User && msg.sender.isBot;
10
- /**
11
- * Filter updates by user ID(s) or username(s)
12
- *
13
- * Note that only some updates support filtering by username.
14
- */
15
- export const userId = (id) => {
16
- const indexId = new Set();
17
- const indexUsername = new Set();
18
- let matchSelf = false;
19
- if (!Array.isArray(id))
20
- id = [id];
21
- id.forEach((id) => {
22
- if (id === 'me' || id === 'self') {
23
- matchSelf = true;
24
- }
25
- else if (typeof id === 'string') {
26
- indexUsername.add(id);
27
- }
28
- else {
29
- indexId.add(id);
30
- }
31
- });
32
- return (upd) => {
33
- switch (upd._name) {
34
- case 'new_message':
35
- case 'edit_message':
36
- case 'new_business_message':
37
- case 'edit_business_message': {
38
- const sender = upd.sender;
39
- return (matchSelf && sender.isSelf)
40
- || indexId.has(sender.id)
41
- || indexUsername.has(sender.username);
42
- }
43
- case 'user_status':
44
- case 'user_typing': {
45
- const id = upd.userId;
46
- return (matchSelf && id === upd.client.storage.self.getCached()?.userId)
47
- || indexId.has(id);
48
- }
49
- case 'poll_vote':
50
- case 'story':
51
- case 'delete_story': {
52
- const peer = upd.peer;
53
- if (peer.type !== 'user')
54
- return false;
55
- return (matchSelf && peer.isSelf)
56
- || indexId.has(peer.id)
57
- || Boolean(peer.usernames?.some(u => indexUsername.has(u.username)));
58
- }
59
- case 'history_read': {
60
- const id = upd.chatId;
61
- return (matchSelf && id === upd.client.storage.self.getCached()?.userId)
62
- || indexId.has(id);
63
- }
64
- }
65
- const user = upd.user;
66
- return ((matchSelf && user.isSelf)
67
- || indexId.has(user.id)
68
- || Boolean(user.usernames?.some(u => indexUsername.has(u.username))));
69
- };
70
- };
71
- //# sourceMappingURL=user.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/filters/user.ts"],"names":[],"mappings":"AAkBA,OAAO,EACH,IAAI,GACP,MAAM,cAAc,CAAA;AAMrB;;GAEG;AACH,MAAM,CAAC,MAAM,EAAE,GAA4C,GAAG,CAAC,EAAE,CAC7D,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,UAAU,CAAA;AAEvE;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG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AAI,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACvE,CAAA;IACL,CAAC,CAAA;AACL,CAAC,CAAA","sourcesContent":["import type {\n BotChatJoinRequestUpdate,\n BusinessCallbackQuery,\n BusinessMessage,\n CallbackQuery,\n ChatMemberUpdate,\n ChosenInlineResult,\n DeleteStoryUpdate,\n HistoryReadUpdate,\n InlineCallbackQuery,\n InlineQuery,\n MaybeArray,\n Message,\n PollVoteUpdate,\n StoryUpdate,\n UserStatusUpdate,\n UserTypingUpdate,\n} from '@mtcute/core'\nimport {\n User,\n} from '@mtcute/core'\n\nimport type { UpdateContextDistributed } from '../context/base.js'\n\nimport type { UpdateFilter } from './types.js'\n\n/**\n * Filter messages generated by yourself (including Saved Messages)\n */\nexport const me: UpdateFilter<Message, { sender: User }> = msg =>\n (msg.sender.type === 'user' && msg.sender.isSelf) || msg.isOutgoing\n\n/**\n * Filter messages sent by bots\n */\nexport const bot: UpdateFilter<Message, { sender: User }> = msg => msg.sender.constructor === User && msg.sender.isBot\n\n/**\n * Filter updates by user ID(s) or username(s)\n *\n * Note that only some updates support filtering by username.\n */\nexport const userId: {\n (id: MaybeArray<number>): UpdateFilter<UpdateContextDistributed<\n | Message\n | BusinessMessage\n | StoryUpdate\n | DeleteStoryUpdate\n | InlineQuery\n | ChatMemberUpdate\n | ChosenInlineResult\n | CallbackQuery\n | InlineCallbackQuery\n | BusinessCallbackQuery\n | PollVoteUpdate\n | BotChatJoinRequestUpdate\n >>\n (id: MaybeArray<number | string>): UpdateFilter<UpdateContextDistributed<\n | Message\n | BusinessMessage\n | UserStatusUpdate\n | UserTypingUpdate\n | StoryUpdate\n | HistoryReadUpdate\n | DeleteStoryUpdate\n | InlineQuery\n | ChatMemberUpdate\n | ChosenInlineResult\n | CallbackQuery\n | InlineCallbackQuery\n | BusinessCallbackQuery\n | PollVoteUpdate\n | BotChatJoinRequestUpdate\n >>\n} = (id) => {\n const indexId = new Set<number>()\n const indexUsername = new Set<string>()\n let matchSelf = false\n\n if (!Array.isArray(id)) id = [id]\n id.forEach((id) => {\n if (id === 'me' || id === 'self') {\n matchSelf = true\n } else if (typeof id === 'string') {\n indexUsername.add(id)\n } else {\n indexId.add(id)\n }\n })\n\n return (upd) => {\n switch (upd._name) {\n case 'new_message':\n case 'edit_message':\n case 'new_business_message':\n case 'edit_business_message': {\n const sender = upd.sender\n\n return (matchSelf && sender.isSelf)\n || indexId.has(sender.id)\n || indexUsername.has(sender.username!)\n }\n case 'user_status':\n case 'user_typing': {\n const id = upd.userId\n\n return (matchSelf && id === upd.client.storage.self.getCached()?.userId)\n || indexId.has(id)\n }\n case 'poll_vote':\n case 'story':\n case 'delete_story': {\n const peer = upd.peer\n if (peer.type !== 'user') return false\n\n return (matchSelf && peer.isSelf)\n || indexId.has(peer.id)\n || Boolean(peer.usernames?.some(u => indexUsername.has(u.username)))\n }\n case 'history_read': {\n const id = upd.chatId\n\n return (matchSelf && id === upd.client.storage.self.getCached()?.userId)\n || indexId.has(id)\n }\n }\n\n const user = upd.user\n\n return (\n (matchSelf && user.isSelf)\n || indexId.has(user.id)\n || Boolean(user.usernames?.some(u => indexUsername.has(u.username)))\n )\n }\n}\n"]}
package/esm/handler.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import type { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessConnection, ChatJoinRequestUpdate, ChatMemberUpdate, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, MaybePromise, PeersIndex, PollUpdate, PollVoteUpdate, StoryUpdate, UserStatusUpdate, UserTypingUpdate, tl } from '@mtcute/core';
2
- import type { TelegramClient } from '@mtcute/core/client.js';
3
- import type { UpdateContext } from './context/base.js';
4
- import type { BusinessCallbackQueryContext, BusinessMessageContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
5
- import type { PropagationAction } from './propagation.js';
6
- export interface BaseUpdateHandler<Name, Handler, Checker> {
7
- name: Name;
8
- callback: Handler;
9
- check?: Checker;
10
- }
11
- export type ParsedUpdateHandler<Name, Update, State = never> = BaseUpdateHandler<Name, (update: Update, state: State) => MaybePromise<void | PropagationAction>, (update: Update, state: State) => MaybePromise<boolean>>;
12
- export type RawUpdateHandler = BaseUpdateHandler<'raw', (client: TelegramClient, update: tl.TypeUpdate | tl.TypeMessage, peers: PeersIndex) => MaybePromise<void | PropagationAction>, (client: TelegramClient, update: tl.TypeUpdate | tl.TypeMessage, peers: PeersIndex) => MaybePromise<boolean>>;
13
- export type NewMessageHandler<T = MessageContext, S = never> = ParsedUpdateHandler<'new_message', T, S>;
14
- export type EditMessageHandler<T = MessageContext, S = never> = ParsedUpdateHandler<'edit_message', T, S>;
15
- export type MessageGroupHandler<T = MessageContext, S = never> = ParsedUpdateHandler<'message_group', T, S>;
16
- export type DeleteMessageHandler<T = UpdateContext<DeleteMessageUpdate>> = ParsedUpdateHandler<'delete_message', T>;
17
- export type ChatMemberUpdateHandler<T = UpdateContext<ChatMemberUpdate>> = ParsedUpdateHandler<'chat_member', T>;
18
- export type InlineQueryHandler<T = InlineQueryContext> = ParsedUpdateHandler<'inline_query', T>;
19
- export type ChosenInlineResultHandler<T = ChosenInlineResultContext> = ParsedUpdateHandler<'chosen_inline_result', T>;
20
- export type CallbackQueryHandler<T = CallbackQueryContext, S = never> = ParsedUpdateHandler<'callback_query', T, S>;
21
- export type InlineCallbackQueryHandler<T = InlineCallbackQueryContext, S = never> = ParsedUpdateHandler<'inline_callback_query', T, S>;
22
- export type BusinessCallbackQueryHandler<T = BusinessCallbackQueryContext, S = never> = ParsedUpdateHandler<'business_callback_query', T, S>;
23
- export type PollUpdateHandler<T = UpdateContext<PollUpdate>> = ParsedUpdateHandler<'poll', T>;
24
- export type PollVoteHandler<T = UpdateContext<PollVoteUpdate>> = ParsedUpdateHandler<'poll_vote', T>;
25
- export type UserStatusUpdateHandler<T = UpdateContext<UserStatusUpdate>> = ParsedUpdateHandler<'user_status', T>;
26
- export type UserTypingHandler<T = UpdateContext<UserTypingUpdate>> = ParsedUpdateHandler<'user_typing', T>;
27
- export type HistoryReadHandler<T = UpdateContext<HistoryReadUpdate>> = ParsedUpdateHandler<'history_read', T>;
28
- export type BotStoppedHandler<T = UpdateContext<BotStoppedUpdate>> = ParsedUpdateHandler<'bot_stopped', T>;
29
- export type BotChatJoinRequestHandler<T = ChatJoinRequestUpdateContext> = ParsedUpdateHandler<'bot_chat_join_request', T>;
30
- export type ChatJoinRequestHandler<T = UpdateContext<ChatJoinRequestUpdate>> = ParsedUpdateHandler<'chat_join_request', T>;
31
- export type PreCheckoutQueryHandler<T = PreCheckoutQueryContext> = ParsedUpdateHandler<'pre_checkout_query', T>;
32
- export type StoryUpdateHandler<T = UpdateContext<StoryUpdate>> = ParsedUpdateHandler<'story', T>;
33
- export type DeleteStoryHandler<T = UpdateContext<DeleteStoryUpdate>> = ParsedUpdateHandler<'delete_story', T>;
34
- export type BotReactionUpdateHandler<T = UpdateContext<BotReactionUpdate>> = ParsedUpdateHandler<'bot_reaction', T>;
35
- export type BotReactionCountUpdateHandler<T = UpdateContext<BotReactionCountUpdate>> = ParsedUpdateHandler<'bot_reaction_count', T>;
36
- export type BusinessConnectionUpdateHandler<T = UpdateContext<BusinessConnection>> = ParsedUpdateHandler<'business_connection', T>;
37
- export type NewBusinessMessageHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'new_business_message', T, S>;
38
- export type EditBusinessMessageHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'edit_business_message', T, S>;
39
- export type BusinessMessageGroupHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'business_message_group', T, S>;
40
- export type DeleteBusinessMessageHandler<T = UpdateContext<DeleteBusinessMessageUpdate>> = ParsedUpdateHandler<'delete_business_message', T>;
41
- export type UpdateHandler = RawUpdateHandler | NewMessageHandler | EditMessageHandler | MessageGroupHandler | DeleteMessageHandler | ChatMemberUpdateHandler | InlineQueryHandler | ChosenInlineResultHandler | CallbackQueryHandler | InlineCallbackQueryHandler | BusinessCallbackQueryHandler | PollUpdateHandler | PollVoteHandler | UserStatusUpdateHandler | UserTypingHandler | HistoryReadHandler | BotStoppedHandler | BotChatJoinRequestHandler | ChatJoinRequestHandler | PreCheckoutQueryHandler | StoryUpdateHandler | DeleteStoryHandler | BotReactionUpdateHandler | BotReactionCountUpdateHandler | BusinessConnectionUpdateHandler | NewBusinessMessageHandler | EditBusinessMessageHandler | BusinessMessageGroupHandler | DeleteBusinessMessageHandler;
package/esm/handler.js DELETED
@@ -1,3 +0,0 @@
1
- export {};
2
- // end-codegen
3
- //# sourceMappingURL=handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":";AA2JA,cAAc","sourcesContent":["import type {\n BotReactionCountUpdate,\n BotReactionUpdate,\n BotStoppedUpdate,\n BusinessConnection,\n ChatJoinRequestUpdate,\n ChatMemberUpdate,\n DeleteBusinessMessageUpdate,\n DeleteMessageUpdate,\n DeleteStoryUpdate,\n HistoryReadUpdate,\n MaybePromise,\n PeersIndex,\n PollUpdate,\n PollVoteUpdate,\n StoryUpdate,\n UserStatusUpdate,\n UserTypingUpdate,\n tl,\n} from '@mtcute/core'\nimport type { TelegramClient } from '@mtcute/core/client.js'\n\nimport type { UpdateContext } from './context/base.js'\nimport type {\n BusinessCallbackQueryContext,\n BusinessMessageContext,\n CallbackQueryContext,\n ChatJoinRequestUpdateContext,\n ChosenInlineResultContext,\n InlineCallbackQueryContext,\n InlineQueryContext,\n MessageContext,\n PreCheckoutQueryContext,\n} from './context/index.js'\nimport type { PropagationAction } from './propagation.js'\n\nexport interface BaseUpdateHandler<Name, Handler, Checker> {\n name: Name\n callback: Handler\n\n check?: Checker\n}\n\nexport type ParsedUpdateHandler<Name, Update, State = never> = BaseUpdateHandler<\n Name,\n (update: Update, state: State) => MaybePromise<void | PropagationAction>,\n (update: Update, state: State) => MaybePromise<boolean>\n>\n\nexport type RawUpdateHandler = BaseUpdateHandler<\n 'raw',\n (\n client: TelegramClient,\n update: tl.TypeUpdate | tl.TypeMessage,\n peers: PeersIndex,\n ) => MaybePromise<void | PropagationAction>,\n (client: TelegramClient, update: tl.TypeUpdate | tl.TypeMessage, peers: PeersIndex) => MaybePromise<boolean>\n>\n\n// begin-codegen\nexport type NewMessageHandler<T = MessageContext, S = never> = ParsedUpdateHandler<'new_message', T, S>\nexport type EditMessageHandler<T = MessageContext, S = never> = ParsedUpdateHandler<'edit_message', T, S>\nexport type MessageGroupHandler<T = MessageContext, S = never> = ParsedUpdateHandler<'message_group', T, S>\nexport type DeleteMessageHandler<T = UpdateContext<DeleteMessageUpdate>> = ParsedUpdateHandler<'delete_message', T>\nexport type ChatMemberUpdateHandler<T = UpdateContext<ChatMemberUpdate>> = ParsedUpdateHandler<'chat_member', T>\nexport type InlineQueryHandler<T = InlineQueryContext> = ParsedUpdateHandler<'inline_query', T>\nexport type ChosenInlineResultHandler<T = ChosenInlineResultContext> = ParsedUpdateHandler<'chosen_inline_result', T>\nexport type CallbackQueryHandler<T = CallbackQueryContext, S = never> = ParsedUpdateHandler<'callback_query', T, S>\nexport type InlineCallbackQueryHandler<T = InlineCallbackQueryContext, S = never> = ParsedUpdateHandler<\n 'inline_callback_query',\n T,\n S\n>\nexport type BusinessCallbackQueryHandler<T = BusinessCallbackQueryContext, S = never> = ParsedUpdateHandler<\n 'business_callback_query',\n T,\n S\n>\nexport type PollUpdateHandler<T = UpdateContext<PollUpdate>> = ParsedUpdateHandler<'poll', T>\nexport type PollVoteHandler<T = UpdateContext<PollVoteUpdate>> = ParsedUpdateHandler<'poll_vote', T>\nexport type UserStatusUpdateHandler<T = UpdateContext<UserStatusUpdate>> = ParsedUpdateHandler<'user_status', T>\nexport type UserTypingHandler<T = UpdateContext<UserTypingUpdate>> = ParsedUpdateHandler<'user_typing', T>\nexport type HistoryReadHandler<T = UpdateContext<HistoryReadUpdate>> = ParsedUpdateHandler<'history_read', T>\nexport type BotStoppedHandler<T = UpdateContext<BotStoppedUpdate>> = ParsedUpdateHandler<'bot_stopped', T>\nexport type BotChatJoinRequestHandler<T = ChatJoinRequestUpdateContext> = ParsedUpdateHandler<\n 'bot_chat_join_request',\n T\n>\nexport type ChatJoinRequestHandler<T = UpdateContext<ChatJoinRequestUpdate>> = ParsedUpdateHandler<\n 'chat_join_request',\n T\n>\nexport type PreCheckoutQueryHandler<T = PreCheckoutQueryContext> = ParsedUpdateHandler<'pre_checkout_query', T>\nexport type StoryUpdateHandler<T = UpdateContext<StoryUpdate>> = ParsedUpdateHandler<'story', T>\nexport type DeleteStoryHandler<T = UpdateContext<DeleteStoryUpdate>> = ParsedUpdateHandler<'delete_story', T>\nexport type BotReactionUpdateHandler<T = UpdateContext<BotReactionUpdate>> = ParsedUpdateHandler<'bot_reaction', T>\nexport type BotReactionCountUpdateHandler<T = UpdateContext<BotReactionCountUpdate>> = ParsedUpdateHandler<\n 'bot_reaction_count',\n T\n>\nexport type BusinessConnectionUpdateHandler<T = UpdateContext<BusinessConnection>> = ParsedUpdateHandler<\n 'business_connection',\n T\n>\nexport type NewBusinessMessageHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<\n 'new_business_message',\n T,\n S\n>\nexport type EditBusinessMessageHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<\n 'edit_business_message',\n T,\n S\n>\nexport type BusinessMessageGroupHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<\n 'business_message_group',\n T,\n S\n>\nexport type DeleteBusinessMessageHandler<T = UpdateContext<DeleteBusinessMessageUpdate>> = ParsedUpdateHandler<\n 'delete_business_message',\n T\n>\n\nexport type UpdateHandler =\n | RawUpdateHandler\n | NewMessageHandler\n | EditMessageHandler\n | MessageGroupHandler\n | DeleteMessageHandler\n | ChatMemberUpdateHandler\n | InlineQueryHandler\n | ChosenInlineResultHandler\n | CallbackQueryHandler\n | InlineCallbackQueryHandler\n | BusinessCallbackQueryHandler\n | PollUpdateHandler\n | PollVoteHandler\n | UserStatusUpdateHandler\n | UserTypingHandler\n | HistoryReadHandler\n | BotStoppedHandler\n | BotChatJoinRequestHandler\n | ChatJoinRequestHandler\n | PreCheckoutQueryHandler\n | StoryUpdateHandler\n | DeleteStoryHandler\n | BotReactionUpdateHandler\n | BotReactionCountUpdateHandler\n | BusinessConnectionUpdateHandler\n | NewBusinessMessageHandler\n | EditBusinessMessageHandler\n | BusinessMessageGroupHandler\n | DeleteBusinessMessageHandler\n\n// end-codegen\n"]}
package/esm/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './callback-data-builder.js';
2
- export * from './context/index.js';
3
- export * from './dispatcher.js';
4
- export * from './filters/index.js';
5
- export * from './handler.js';
6
- export * from './propagation.js';
7
- export * from './state/index.js';
8
- export * from './wizard.js';
package/esm/index.js DELETED
@@ -1,9 +0,0 @@
1
- export * from './callback-data-builder.js';
2
- export * from './context/index.js';
3
- export * from './dispatcher.js';
4
- export * from './filters/index.js';
5
- export * from './handler.js';
6
- export * from './propagation.js';
7
- export * from './state/index.js';
8
- export * from './wizard.js';
9
- //# sourceMappingURL=index.js.map
package/esm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA","sourcesContent":["export * from './callback-data-builder.js'\nexport * from './context/index.js'\nexport * from './dispatcher.js'\nexport * from './filters/index.js'\nexport * from './handler.js'\nexport * from './propagation.js'\nexport * from './state/index.js'\nexport * from './wizard.js'\n"]}