grammy 1.8.2 β 1.9.1
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.
- package/README.md +20 -9
- package/out/composer.d.ts +60 -10
- package/out/composer.js +36 -1
- package/out/context.d.ts +34 -34
- package/out/context.js +6 -6
- package/out/convenience/frameworks.node.d.ts +14 -0
- package/out/convenience/frameworks.node.js +17 -0
- package/out/convenience/keyboard.d.ts +2 -2
- package/out/convenience/keyboard.js +2 -2
- package/out/convenience/session.js +2 -0
- package/out/convenience/webhook.d.ts +35 -6
- package/out/convenience/webhook.js +17 -27
- package/out/core/api.d.ts +70 -55
- package/out/core/api.js +28 -3
- package/out/core/client.d.ts +1 -2
- package/out/core/payload.js +1 -1
- package/out/filter.d.ts +12 -0
- package/out/filter.js +2 -0
- package/out/mod.d.ts +1 -1
- package/out/mod.js +1 -1
- package/out/platform.node.d.ts +5 -1
- package/out/types.d.ts +1 -0
- package/out/types.js +17 -0
- package/out/types.node.d.ts +64 -0
- package/out/types.node.js +93 -0
- package/package.json +4 -9
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@ _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_cur
|
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
|
+
[](https://deno.land/x/grammy)
|
|
15
|
+
[](https://www.npmjs.org/package/grammy)
|
|
16
|
+
[](#contributors-)
|
|
17
17
|
|
|
18
18
|
<!-- deno-fmt-ignore-end -->
|
|
19
19
|
|
|
@@ -140,11 +140,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
140
140
|
<tr>
|
|
141
141
|
<td align="center"><a href="https://edjopato.de/"><img src="https://avatars.githubusercontent.com/u/7953011?v=4?s=100" width="100px;" alt=""/><br /><sub><b>EdJoPaTo</b></sub></a><br /><a href="#plugin-EdJoPaTo" title="Plugin/utility libraries">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=EdJoPaTo" title="Documentation">π</a> <a href="#ideas-EdJoPaTo" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AEdJoPaTo" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AEdJoPaTo" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=EdJoPaTo" title="Code">π»</a></td>
|
|
142
142
|
<td align="center"><a href="https://github.com/Amir-Zouerami"><img src="https://avatars.githubusercontent.com/u/53701884?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Amir Zouerami</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Amir-Zouerami" title="Documentation">π</a> <a href="#plugin-Amir-Zouerami" title="Plugin/utility libraries">π</a> <a href="#example-Amir-Zouerami" title="Examples">π‘</a></td>
|
|
143
|
-
<td align="center"><a href="https://github.com/roj1512"><img src="https://avatars.githubusercontent.com/u/49933115?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roj</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=roj1512" title="Documentation">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Aroj1512" title="Reviewed Pull Requests">π</a> <a href="#infra-roj1512" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#translation-roj1512" title="Translation">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=roj1512" title="Code">π»</a> <a href="#ideas-roj1512" title="Ideas, Planning, & Feedback">π€</a> <a href="#mentoring-roj1512" title="Mentoring">π§βπ«</a></td>
|
|
143
|
+
<td align="center"><a href="https://github.com/roj1512"><img src="https://avatars.githubusercontent.com/u/49933115?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roj</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=roj1512" title="Documentation">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Aroj1512" title="Reviewed Pull Requests">π</a> <a href="#infra-roj1512" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#translation-roj1512" title="Translation">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=roj1512" title="Code">π»</a> <a href="#ideas-roj1512" title="Ideas, Planning, & Feedback">π€</a> <a href="#mentoring-roj1512" title="Mentoring">π§βπ«</a> <a href="#example-roj1512" title="Examples">π‘</a></td>
|
|
144
144
|
<td align="center"><a href="https://github.com/jokasimr"><img src="https://avatars.githubusercontent.com/u/20954731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jokasimr</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ajokasimr" title="Bug reports">π</a></td>
|
|
145
145
|
<td align="center"><a href="https://github.com/CikiMomogi"><img src="https://avatars.githubusercontent.com/u/74030149?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ciki Momogi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=CikiMomogi" title="Documentation">π</a></td>
|
|
146
146
|
<td align="center"><a href="https://github.com/AndreoliBR"><img src="https://avatars.githubusercontent.com/u/15970011?v=4?s=100" width="100px;" alt=""/><br /><sub><b>AndreoliBR</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AAndreoliBR" title="Reviewed Pull Requests">π</a></td>
|
|
147
|
-
<td align="center"><a href="https://github.com/Loskir"><img src="https://avatars.githubusercontent.com/u/21295738?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kirill Loskutov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Loskir" title="Documentation">π</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3ALoskir" title="Bug reports">π</a> <a href="#ideas-Loskir" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
147
|
+
<td align="center"><a href="https://github.com/Loskir"><img src="https://avatars.githubusercontent.com/u/21295738?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kirill Loskutov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Loskir" title="Documentation">π</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3ALoskir" title="Bug reports">π</a> <a href="#ideas-Loskir" title="Ideas, Planning, & Feedback">π€</a> <a href="#design-Loskir" title="Design">π¨</a> <a href="#question-Loskir" title="Answering Questions">π¬</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3ALoskir" title="Reviewed Pull Requests">π</a></td>
|
|
148
148
|
</tr>
|
|
149
149
|
<tr>
|
|
150
150
|
<td align="center"><a href="https://lungers.com/"><img src="https://avatars.githubusercontent.com/u/32808683?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrew Lane</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3AAndrewLaneX" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AAndrewLaneX" title="Reviewed Pull Requests">π</a></td>
|
|
@@ -177,19 +177,19 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
177
177
|
<td align="center"><a href="https://github.com/taotie111"><img src="https://avatars.githubusercontent.com/u/44166322?v=4?s=100" width="100px;" alt=""/><br /><sub><b>taotie111</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=taotie111" title="Documentation">π</a> <a href="#translation-taotie111" title="Translation">π</a></td>
|
|
178
178
|
<td align="center"><a href="https://www.linkedin.com/in/merlin-brandes-42328717a/"><img src="https://avatars.githubusercontent.com/u/14237330?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Merlin</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=FatalMerlin" title="Documentation">π</a></td>
|
|
179
179
|
<td align="center"><a href="https://darve.sh"><img src="https://avatars.githubusercontent.com/u/22394081?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Darvesh</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adarvesh" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=darvesh" title="Code">π»</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adarvesh" title="Reviewed Pull Requests">π</a></td>
|
|
180
|
-
<td align="center"><a href="http://telegram.me/dcdunkan"><img src="https://avatars.githubusercontent.com/u/70066170?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dcdunkan</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adcdunkan" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Code">π»</a> <a href="#plugin-dcdunkan" title="Plugin/utility libraries">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adcdunkan" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Documentation">π</a></td>
|
|
180
|
+
<td align="center"><a href="http://telegram.me/dcdunkan"><img src="https://avatars.githubusercontent.com/u/70066170?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dcdunkan</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adcdunkan" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Code">π»</a> <a href="#plugin-dcdunkan" title="Plugin/utility libraries">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adcdunkan" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Documentation">π</a> <a href="#ideas-dcdunkan" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-dcdunkan" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
|
|
181
181
|
<td align="center"><a href="https://xuann.wang/"><img src="https://avatars.githubusercontent.com/u/44045911?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kid</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=kidonng" title="Documentation">π</a> <a href="#translation-kidonng" title="Translation">π</a></td>
|
|
182
182
|
<td align="center"><a href="http://slava.fomin.io/"><img src="https://avatars.githubusercontent.com/u/1702725?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Slava Fomin II</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aslavafomin" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=slavafomin" title="Documentation">π</a></td>
|
|
183
183
|
<td align="center"><a href="https://kikobeats.com/"><img src="https://avatars.githubusercontent.com/u/2096101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kiko Beats</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Kikobeats" title="Documentation">π</a></td>
|
|
184
184
|
</tr>
|
|
185
185
|
<tr>
|
|
186
186
|
<td align="center"><a href="http://///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////kraftwerk28.pp.ua"><img src="https://avatars.githubusercontent.com/u/31807671?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vsevolod</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=kraftwerk28" title="Code">π»</a> <a href="#ideas-kraftwerk28" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Akraftwerk28" title="Reviewed Pull Requests">π</a></td>
|
|
187
|
-
<td align="center"><a href="https://github.com/habemuscode"><img src="https://avatars.githubusercontent.com/u/34692207?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Habemuscode</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ahabemuscode" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=habemuscode" title="Documentation">π</a></td>
|
|
187
|
+
<td align="center"><a href="https://github.com/habemuscode"><img src="https://avatars.githubusercontent.com/u/34692207?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Habemuscode</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ahabemuscode" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=habemuscode" title="Documentation">π</a> <a href="#translation-habemuscode" title="Translation">π</a></td>
|
|
188
188
|
<td align="center"><a href="https://borodutch.com/"><img src="https://avatars.githubusercontent.com/u/3192028?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikita Kolmogorov</b></sub></a><br /><a href="#plugin-backmeupplz" title="Plugin/utility libraries">π</a></td>
|
|
189
189
|
<td align="center"><a href="http://glukki.ru"><img src="https://avatars.githubusercontent.com/u/140462?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vitaliy Meshchaninov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aglukki" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=glukki" title="Code">π»</a></td>
|
|
190
190
|
<td align="center"><a href="https://github.com/dilyanpalauzov"><img src="https://avatars.githubusercontent.com/u/4992947?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ΠΠΈΠ»ΡΠ½ ΠΠ°Π»Π°ΡΠ·ΠΎΠ²</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adilyanpalauzov" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dilyanpalauzov" title="Code">π»</a></td>
|
|
191
191
|
<td align="center"><a href="https://github.com/lmx-Hexagram"><img src="https://avatars.githubusercontent.com/u/52130356?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lmx-Hexagram</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=lmx-Hexagram" title="Documentation">π</a></td>
|
|
192
|
-
<td align="center"><a href="https://github.com/IlyaSemenov"><img src="https://avatars.githubusercontent.com/u/128121?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ilya Semenov</b></sub></a><br /><a href="#ideas-IlyaSemenov" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AIlyaSemenov" title="Reviewed Pull Requests">π</a></td>
|
|
192
|
+
<td align="center"><a href="https://github.com/IlyaSemenov"><img src="https://avatars.githubusercontent.com/u/128121?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ilya Semenov</b></sub></a><br /><a href="#ideas-IlyaSemenov" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AIlyaSemenov" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=IlyaSemenov" title="Code">π»</a></td>
|
|
193
193
|
</tr>
|
|
194
194
|
<tr>
|
|
195
195
|
<td align="center"><a href="https://github.com/abdollahzadehAli"><img src="https://avatars.githubusercontent.com/u/96317431?v=4?s=100" width="100px;" alt=""/><br /><sub><b>abdollahzadehAli</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=abdollahzadehAli" title="Documentation">π</a> <a href="#example-abdollahzadehAli" title="Examples">π‘</a></td>
|
|
@@ -197,6 +197,17 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
197
197
|
<td align="center"><a href="https://github.com/Scrip7"><img src="https://avatars.githubusercontent.com/u/37535505?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hesoyam</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Scrip7" title="Documentation">π</a></td>
|
|
198
198
|
<td align="center"><a href="http://yrz.am"><img src="https://avatars.githubusercontent.com/u/96742416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>yrzam</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ayrzam" title="Bug reports">π</a></td>
|
|
199
199
|
<td align="center"><a href="https://github.com/drmikecrowe"><img src="https://avatars.githubusercontent.com/u/90312?v=4?s=100" width="100px;" alt=""/><br /><sub><b>drmikecrowe</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adrmikecrowe" title="Reviewed Pull Requests">π</a></td>
|
|
200
|
+
<td align="center"><a href="https://rys.pw"><img src="https://avatars.githubusercontent.com/u/1641362?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Martin</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=C0rn3j" title="Documentation">π</a></td>
|
|
201
|
+
<td align="center"><a href="http://pavelpolyakov.com/"><img src="https://avatars.githubusercontent.com/u/839290?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pavel</b></sub></a><br /><a href="#example-PavelPolyakov" title="Examples">π‘</a></td>
|
|
202
|
+
</tr>
|
|
203
|
+
<tr>
|
|
204
|
+
<td align="center"><a href="https://youtube.com/thorwebdev"><img src="https://avatars.githubusercontent.com/u/5748289?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thor ι·η₯ Schaeff</b></sub></a><br /><a href="#example-thorwebdev" title="Examples">π‘</a></td>
|
|
205
|
+
<td align="center"><a href="https://github.com/x066it"><img src="https://avatars.githubusercontent.com/u/75589380?v=4?s=100" width="100px;" alt=""/><br /><sub><b>x066it</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ax066it" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ax066it" title="Reviewed Pull Requests">π</a></td>
|
|
206
|
+
<td align="center"><a href="https://github.com/kolay-v"><img src="https://avatars.githubusercontent.com/u/49853802?v=4?s=100" width="100px;" alt=""/><br /><sub><b>kolay</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Akolay-v" title="Reviewed Pull Requests">π</a></td>
|
|
207
|
+
<td align="center"><a href="https://enepom.com/"><img src="https://avatars.githubusercontent.com/u/2511553?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evgeny Nepomnyashchiy</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Apizzaeater" title="Reviewed Pull Requests">π</a></td>
|
|
208
|
+
<td align="center"><a href="https://github.com/anantakrishna"><img src="https://avatars.githubusercontent.com/u/6065071?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ananta Krsna dasa</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=anantakrishna" title="Documentation">π</a></td>
|
|
209
|
+
<td align="center"><a href="https://github.com/Mi3liX9"><img src="https://avatars.githubusercontent.com/u/26169870?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mighty Ali</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Mi3liX9" title="Code">π»</a></td>
|
|
210
|
+
<td align="center"><a href="https://oott123.com"><img src="https://avatars.githubusercontent.com/u/905663?v=4?s=100" width="100px;" alt=""/><br /><sub><b>δΈδΈ</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aoott123" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=oott123" title="Code">π»</a></td>
|
|
200
211
|
</tr>
|
|
201
212
|
</table>
|
|
202
213
|
|
package/out/composer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Context } from "./context.js";
|
|
1
|
+
import { type AliasProps, type Context } from "./context.js";
|
|
2
2
|
import { type Filter, type FilterQuery } from "./filter.js";
|
|
3
|
+
import { type Chat } from "./platform.node.js";
|
|
3
4
|
declare type MaybePromise<T> = T | Promise<T>;
|
|
4
5
|
declare type MaybeArray<T> = T | T[];
|
|
5
6
|
declare type StringWithSuggestions<S extends string> = (string & {}) | S;
|
|
@@ -212,7 +213,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
|
|
|
212
213
|
* @param trigger The text to look for
|
|
213
214
|
* @param middleware The middleware to register
|
|
214
215
|
*/
|
|
215
|
-
hears(trigger: MaybeArray<string | RegExp>, ...middleware: Array<
|
|
216
|
+
hears(trigger: MaybeArray<string | RegExp>, ...middleware: Array<HearsMiddleware<C>>): Composer<HearsContext<C>>;
|
|
216
217
|
/**
|
|
217
218
|
* Registers some middleware that will only be executed when a certain
|
|
218
219
|
* command is found.
|
|
@@ -268,7 +269,39 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
|
|
|
268
269
|
* @param command The command to look for
|
|
269
270
|
* @param middleware The middleware to register
|
|
270
271
|
*/
|
|
271
|
-
command<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>, ...middleware: Array<
|
|
272
|
+
command<S extends string>(command: MaybeArray<StringWithSuggestions<S | "start" | "help" | "settings">>, ...middleware: Array<CommandMiddleware<C>>): Composer<CommandContext<C>>;
|
|
273
|
+
/**
|
|
274
|
+
* Registers some middleware for certain chat types only. For example, you
|
|
275
|
+
* can use this method to only receive updates from private chats. The four
|
|
276
|
+
* chat types are `"channel"`, `"supergroup"`, `"group"`, and `"private"`.
|
|
277
|
+
* This is especially useful when combined with other filtering logic. For
|
|
278
|
+
* example, this is how can you respond to `/start` commands only from
|
|
279
|
+
* private chats:
|
|
280
|
+
* ```ts
|
|
281
|
+
* bot.chatType("private").command("start", ctx => { ... })
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* Naturally, you can also use this method on its own.
|
|
285
|
+
* ```ts
|
|
286
|
+
* // Private chats only
|
|
287
|
+
* bot.chatType("private", ctx => { ... });
|
|
288
|
+
* // Channels only
|
|
289
|
+
* bot.chatType("channel", ctx => { ... });
|
|
290
|
+
* ```
|
|
291
|
+
*
|
|
292
|
+
* You can pass an array of chat types if you want your middleware to run
|
|
293
|
+
* for any of several provided chat types.
|
|
294
|
+
* ```ts
|
|
295
|
+
* // Groups and supergroups only
|
|
296
|
+
* bot.chatType(["group", "supergroup"], ctx => { ... });
|
|
297
|
+
* ```
|
|
298
|
+
* [Remember](https://grammy.dev/guide/context.html#shortcuts) also that you
|
|
299
|
+
* can access the chat type via `ctx.chat.type`.
|
|
300
|
+
*
|
|
301
|
+
* @param chatType The chat type
|
|
302
|
+
* @param middleware The middleware to register
|
|
303
|
+
*/
|
|
304
|
+
chatType<T extends Chat["type"]>(chatType: MaybeArray<T>, ...middleware: Array<Middleware<ChatTypeContext<C, T>>>): Composer<ChatTypeContext<C, T>>;
|
|
272
305
|
/**
|
|
273
306
|
* Registers some middleware for callback queries, i.e. the updates that
|
|
274
307
|
* Telegram delivers to your bot when a user clicks an inline button (that
|
|
@@ -309,7 +342,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
|
|
|
309
342
|
* @param trigger The string to look for in the payload
|
|
310
343
|
* @param middleware The middleware to register
|
|
311
344
|
*/
|
|
312
|
-
callbackQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<
|
|
345
|
+
callbackQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<CallbackQueryMiddleware<C>>): Composer<CallbackQueryContext<C>>;
|
|
313
346
|
/**
|
|
314
347
|
* Registers some middleware for game queries, i.e. the updates that
|
|
315
348
|
* Telegram delivers to your bot when a user clicks an inline button for the
|
|
@@ -328,7 +361,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
|
|
|
328
361
|
* @param trigger The string to look for in the payload
|
|
329
362
|
* @param middleware The middleware to register
|
|
330
363
|
*/
|
|
331
|
-
gameQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<
|
|
364
|
+
gameQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<GameQueryMiddleware<C>>): Composer<GameQueryContext<C>>;
|
|
332
365
|
/**
|
|
333
366
|
* Registers middleware for inline queries. Telegram sends an inline query
|
|
334
367
|
* to your bot whenever a user types β@your_bot_name ...β into a text field
|
|
@@ -351,7 +384,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
|
|
|
351
384
|
* @param trigger The inline query text to match
|
|
352
385
|
* @param middleware The middleware to register
|
|
353
386
|
*/
|
|
354
|
-
inlineQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<
|
|
387
|
+
inlineQuery(trigger: MaybeArray<string | RegExp>, ...middleware: Array<InlineQueryMiddleware<C>>): Composer<InlineQueryContext<C>>;
|
|
355
388
|
/**
|
|
356
389
|
* > This is an advanced method of grammY.
|
|
357
390
|
*
|
|
@@ -553,10 +586,27 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
|
|
|
553
586
|
*/
|
|
554
587
|
errorBoundary(errorHandler: (error: BotError<C>, next: NextFunction) => MaybePromise<unknown>, ...middleware: Array<Middleware<C>>): Composer<C>;
|
|
555
588
|
}
|
|
556
|
-
declare type HearsContext<C extends Context> = Filter<C & {
|
|
557
|
-
match: string | RegExpMatchArray
|
|
589
|
+
export declare type HearsContext<C extends Context> = Filter<Omit<C, "match"> & {
|
|
590
|
+
match: Extract<C["match"], string | RegExpMatchArray>;
|
|
558
591
|
}, ":text" | ":caption">;
|
|
559
|
-
declare type CommandContext<C extends Context> = Filter<C & {
|
|
560
|
-
match: string
|
|
592
|
+
export declare type CommandContext<C extends Context> = Filter<Omit<C, "match"> & {
|
|
593
|
+
match: Extract<C["match"], string>;
|
|
561
594
|
}, ":entities:bot_command">;
|
|
595
|
+
export declare type CallbackQueryContext<C extends Context> = Filter<C, "callback_query:data">;
|
|
596
|
+
export declare type GameQueryContext<C extends Context> = Filter<C, "callback_query:game_short_name">;
|
|
597
|
+
export declare type InlineQueryContext<C extends Context> = Filter<C, "inline_query">;
|
|
598
|
+
export declare type ChatTypeContext<C extends Context, T extends Chat["type"]> = C & Record<"update", ChatTypeUpdate<T>> & ChatType<T> & ChatTypeRecord<"msg", T> & AliasProps<ChatTypeUpdate<T>>;
|
|
599
|
+
declare type ChatTypeUpdate<T extends Chat["type"]> = ChatTypeRecord<"message" | "edited_message" | "channel_post" | "edited_channel_post" | "my_chat_member" | "chat_member" | "chat_join_request", T> & Partial<Record<"callback_query", ChatTypeRecord<"message", T>>>;
|
|
600
|
+
declare type ChatTypeRecord<K extends string, T extends Chat["type"]> = Partial<Record<K, ChatType<T>>>;
|
|
601
|
+
interface ChatType<T extends Chat["type"]> {
|
|
602
|
+
chat: {
|
|
603
|
+
type: T;
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
export declare type HearsMiddleware<C extends Context> = Middleware<HearsContext<C>>;
|
|
607
|
+
export declare type CommandMiddleware<C extends Context> = Middleware<CommandContext<C>>;
|
|
608
|
+
export declare type CallbackQueryMiddleware<C extends Context> = Middleware<CallbackQueryContext<C>>;
|
|
609
|
+
export declare type GameQueryMiddleware<C extends Context> = Middleware<GameQueryContext<C>>;
|
|
610
|
+
export declare type InlineQueryMiddleware<C extends Context> = Middleware<InlineQueryContext<C>>;
|
|
611
|
+
export declare type ChatTypeMiddleware<C extends Context, T extends Chat["type"]> = Middleware<ChatTypeContext<C, T>>;
|
|
562
612
|
export {};
|
package/out/composer.js
CHANGED
|
@@ -317,6 +317,41 @@ class Composer {
|
|
|
317
317
|
});
|
|
318
318
|
}, ...middleware);
|
|
319
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Registers some middleware for certain chat types only. For example, you
|
|
322
|
+
* can use this method to only receive updates from private chats. The four
|
|
323
|
+
* chat types are `"channel"`, `"supergroup"`, `"group"`, and `"private"`.
|
|
324
|
+
* This is especially useful when combined with other filtering logic. For
|
|
325
|
+
* example, this is how can you respond to `/start` commands only from
|
|
326
|
+
* private chats:
|
|
327
|
+
* ```ts
|
|
328
|
+
* bot.chatType("private").command("start", ctx => { ... })
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* Naturally, you can also use this method on its own.
|
|
332
|
+
* ```ts
|
|
333
|
+
* // Private chats only
|
|
334
|
+
* bot.chatType("private", ctx => { ... });
|
|
335
|
+
* // Channels only
|
|
336
|
+
* bot.chatType("channel", ctx => { ... });
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* You can pass an array of chat types if you want your middleware to run
|
|
340
|
+
* for any of several provided chat types.
|
|
341
|
+
* ```ts
|
|
342
|
+
* // Groups and supergroups only
|
|
343
|
+
* bot.chatType(["group", "supergroup"], ctx => { ... });
|
|
344
|
+
* ```
|
|
345
|
+
* [Remember](https://grammy.dev/guide/context.html#shortcuts) also that you
|
|
346
|
+
* can access the chat type via `ctx.chat.type`.
|
|
347
|
+
*
|
|
348
|
+
* @param chatType The chat type
|
|
349
|
+
* @param middleware The middleware to register
|
|
350
|
+
*/
|
|
351
|
+
chatType(chatType, ...middleware) {
|
|
352
|
+
const set = new Set(toArray(chatType));
|
|
353
|
+
return this.filter((ctx) => { var _a; return ((_a = ctx.chat) === null || _a === void 0 ? void 0 : _a.type) !== undefined && set.has(ctx.chat.type); }, ...middleware);
|
|
354
|
+
}
|
|
320
355
|
/**
|
|
321
356
|
* Registers some middleware for callback queries, i.e. the updates that
|
|
322
357
|
* Telegram delivers to your bot when a user clicks an inline button (that
|
|
@@ -618,7 +653,7 @@ class Composer {
|
|
|
618
653
|
}
|
|
619
654
|
}
|
|
620
655
|
exports.Composer = Composer;
|
|
621
|
-
// === Util functions
|
|
656
|
+
// === Util functions
|
|
622
657
|
function triggerFn(trigger) {
|
|
623
658
|
return toArray(trigger).map((t) => typeof t === "string"
|
|
624
659
|
? (txt) => (txt === t ? t : null)
|
package/out/context.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type Chat, type ChatPermissions, type InlineQueryResult, type InputFile
|
|
|
4
4
|
declare type Other<M extends Methods<RawApi>, X extends string = never> = OtherApi<RawApi, M, X>;
|
|
5
5
|
declare type SnakeToCamelCase<S extends string> = S extends `${infer L}_${infer R}` ? `${L}${Capitalize<SnakeToCamelCase<R>>}` : S;
|
|
6
6
|
export declare type AliasProps<U> = {
|
|
7
|
-
[
|
|
7
|
+
[K in string & keyof U as SnakeToCamelCase<K>]: U[K];
|
|
8
8
|
};
|
|
9
9
|
declare type RenamedUpdate = AliasProps<Omit<Update, "update_id">>;
|
|
10
10
|
/**
|
|
@@ -86,34 +86,34 @@ export declare class Context implements RenamedUpdate {
|
|
|
86
86
|
/** Alias for `ctx.update.edited_channel_post` */
|
|
87
87
|
get editedChannelPost(): Message | undefined;
|
|
88
88
|
/** Alias for `ctx.update.inline_query` */
|
|
89
|
-
get inlineQuery(): import("@grammyjs/types/inline").InlineQuery | undefined;
|
|
89
|
+
get inlineQuery(): import("@grammyjs/types/inline.js").InlineQuery | undefined;
|
|
90
90
|
/** Alias for `ctx.update.chosen_inline_result` */
|
|
91
|
-
get chosenInlineResult(): import("@grammyjs/types/inline").ChosenInlineResult | undefined;
|
|
91
|
+
get chosenInlineResult(): import("@grammyjs/types/inline.js").ChosenInlineResult | undefined;
|
|
92
92
|
/** Alias for `ctx.update.callback_query` */
|
|
93
|
-
get callbackQuery(): import("@grammyjs/types/markup").CallbackQuery | undefined;
|
|
93
|
+
get callbackQuery(): import("@grammyjs/types/markup.js").CallbackQuery | undefined;
|
|
94
94
|
/** Alias for `ctx.update.shipping_query` */
|
|
95
|
-
get shippingQuery(): import("@grammyjs/types/payment").ShippingQuery | undefined;
|
|
95
|
+
get shippingQuery(): import("@grammyjs/types/payment.js").ShippingQuery | undefined;
|
|
96
96
|
/** Alias for `ctx.update.pre_checkout_query` */
|
|
97
|
-
get preCheckoutQuery(): import("@grammyjs/types/payment").PreCheckoutQuery | undefined;
|
|
97
|
+
get preCheckoutQuery(): import("@grammyjs/types/payment.js").PreCheckoutQuery | undefined;
|
|
98
98
|
/** Alias for `ctx.update.poll` */
|
|
99
|
-
get poll(): import("@grammyjs/types/message").Poll | undefined;
|
|
99
|
+
get poll(): import("@grammyjs/types/message.js").Poll | undefined;
|
|
100
100
|
/** Alias for `ctx.update.poll_answer` */
|
|
101
|
-
get pollAnswer(): import("@grammyjs/types/message").PollAnswer | undefined;
|
|
101
|
+
get pollAnswer(): import("@grammyjs/types/message.js").PollAnswer | undefined;
|
|
102
102
|
/** Alias for `ctx.update.my_chat_member` */
|
|
103
|
-
get myChatMember(): import("@grammyjs/types/manage").ChatMemberUpdated | undefined;
|
|
103
|
+
get myChatMember(): import("@grammyjs/types/manage.js").ChatMemberUpdated | undefined;
|
|
104
104
|
/** Alias for `ctx.update.chat_member` */
|
|
105
|
-
get chatMember(): import("@grammyjs/types/manage").ChatMemberUpdated | undefined;
|
|
105
|
+
get chatMember(): import("@grammyjs/types/manage.js").ChatMemberUpdated | undefined;
|
|
106
106
|
/** Alias for `ctx.update.chat_join_request` */
|
|
107
|
-
get chatJoinRequest(): import("@grammyjs/types/manage").ChatJoinRequest | undefined;
|
|
107
|
+
get chatJoinRequest(): import("@grammyjs/types/manage.js").ChatJoinRequest | undefined;
|
|
108
108
|
/**
|
|
109
|
-
* Get message object from
|
|
109
|
+
* Get message object from wherever possible. Alias for `ctx.message ??
|
|
110
110
|
* ctx.editedMessage ?? ctx.callbackQuery?.message ?? ctx.channelPost ??
|
|
111
111
|
* ctx.editedChannelPost`
|
|
112
112
|
*/
|
|
113
113
|
get msg(): Message | undefined;
|
|
114
114
|
/**
|
|
115
|
-
* Get chat object from
|
|
116
|
-
*
|
|
115
|
+
* Get chat object from wherever possible. Alias for `(ctx.msg ??
|
|
116
|
+
* ctx.myChatMember ?? ctx.chatMember ?? ctx.chatJoinRequest)?.chat`
|
|
117
117
|
*/
|
|
118
118
|
get chat(): Chat | undefined;
|
|
119
119
|
/**
|
|
@@ -122,14 +122,14 @@ export declare class Context implements RenamedUpdate {
|
|
|
122
122
|
*/
|
|
123
123
|
get senderChat(): Chat | undefined;
|
|
124
124
|
/**
|
|
125
|
-
* Get message author from
|
|
125
|
+
* Get message author from wherever possible. Alias for
|
|
126
126
|
* `(ctx.callbackQuery?? ctx.inlineQuery ?? ctx.shippingQuery ??
|
|
127
127
|
* ctx.preCheckoutQuery ?? ctx.chosenInlineResult ?? ctx.msg ??
|
|
128
|
-
*
|
|
128
|
+
* ctx.myChatMember ?? ctx.chatMember ?? ctx.chatJoinRequest)?.from`
|
|
129
129
|
*/
|
|
130
130
|
get from(): User | undefined;
|
|
131
131
|
/**
|
|
132
|
-
* Get inline message ID from
|
|
132
|
+
* Get inline message ID from wherever possible. Alias for
|
|
133
133
|
* `(ctx.callbackQuery ?? ctx.chosenInlineResult)?.inline_message_id`
|
|
134
134
|
*/
|
|
135
135
|
get inlineMessageId(): string | undefined;
|
|
@@ -162,7 +162,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
162
162
|
*
|
|
163
163
|
* **Official reference:** https://core.telegram.org/bots/api#copymessage
|
|
164
164
|
*/
|
|
165
|
-
copyMessage(chat_id: number | string, other?: Other<"copyMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message").MessageId>;
|
|
165
|
+
copyMessage(chat_id: number | string, other?: Other<"copyMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId>;
|
|
166
166
|
/**
|
|
167
167
|
* Context-aware alias for `api.sendPhoto`. Use this method to send photos. On success, the sent Message is returned.
|
|
168
168
|
*
|
|
@@ -267,7 +267,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
267
267
|
*
|
|
268
268
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
|
|
269
269
|
*/
|
|
270
|
-
editMessageLiveLocation(latitude: number, longitude: number, other?: Other<"editMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id" | "latitude" | "longitude">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & import("@grammyjs/types/message").MsgWith<"location">)>;
|
|
270
|
+
editMessageLiveLocation(latitude: number, longitude: number, other?: Other<"editMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id" | "latitude" | "longitude">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & import("@grammyjs/types/message.js").MsgWith<"location">)>;
|
|
271
271
|
/**
|
|
272
272
|
* Context-aware alias for `api.stopMessageLiveLocation`. Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
273
273
|
*
|
|
@@ -276,7 +276,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
276
276
|
*
|
|
277
277
|
* **Official reference:** https://core.telegram.org/bots/api#stopmessagelivelocation
|
|
278
278
|
*/
|
|
279
|
-
stopMessageLiveLocation(other?: Other<"stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & import("@grammyjs/types/message").MsgWith<"location">)>;
|
|
279
|
+
stopMessageLiveLocation(other?: Other<"stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & import("@grammyjs/types/message.js").MsgWith<"location">)>;
|
|
280
280
|
/**
|
|
281
281
|
* Context-aware alias for `api.sendVenue`. Use this method to send information about a venue. On success, the sent Message is returned.
|
|
282
282
|
*
|
|
@@ -344,7 +344,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
344
344
|
*
|
|
345
345
|
* **Official reference:** https://core.telegram.org/bots/api#getuserprofilephotos
|
|
346
346
|
*/
|
|
347
|
-
getUserProfilePhotos(other?: Other<"getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage").UserProfilePhotos>;
|
|
347
|
+
getUserProfilePhotos(other?: Other<"getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfilePhotos>;
|
|
348
348
|
/**
|
|
349
349
|
* Context-aware alias for `api.getFile`. Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
|
|
350
350
|
*
|
|
@@ -354,7 +354,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
354
354
|
*
|
|
355
355
|
* **Official reference:** https://core.telegram.org/bots/api#getfile
|
|
356
356
|
*/
|
|
357
|
-
getFile(signal?: AbortSignal): Promise<import("@grammyjs/types/manage").File>;
|
|
357
|
+
getFile(signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").File>;
|
|
358
358
|
/** @deprecated Use `banAuthor` instead. */
|
|
359
359
|
kickAuthor(...args: Parameters<Context["banAuthor"]>): Promise<true>;
|
|
360
360
|
/**
|
|
@@ -491,7 +491,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
491
491
|
*
|
|
492
492
|
* **Official reference:** https://core.telegram.org/bots/api#createchatinvitelink
|
|
493
493
|
*/
|
|
494
|
-
createChatInviteLink(other?: Other<"createChatInviteLink", "chat_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatInviteLink>;
|
|
494
|
+
createChatInviteLink(other?: Other<"createChatInviteLink", "chat_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatInviteLink>;
|
|
495
495
|
/**
|
|
496
496
|
* Context-aware alias for `api.editChatInviteLink`. Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.
|
|
497
497
|
*
|
|
@@ -501,7 +501,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
501
501
|
*
|
|
502
502
|
* **Official reference:** https://core.telegram.org/bots/api#editchatinvitelink
|
|
503
503
|
*/
|
|
504
|
-
editChatInviteLink(invite_link: string, other?: Other<"editChatInviteLink", "chat_id" | "invite_link">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatInviteLink>;
|
|
504
|
+
editChatInviteLink(invite_link: string, other?: Other<"editChatInviteLink", "chat_id" | "invite_link">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatInviteLink>;
|
|
505
505
|
/**
|
|
506
506
|
* Context-aware alias for `api.revokeChatInviteLink`. Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.
|
|
507
507
|
*
|
|
@@ -510,7 +510,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
510
510
|
*
|
|
511
511
|
* **Official reference:** https://core.telegram.org/bots/api#revokechatinvitelink
|
|
512
512
|
*/
|
|
513
|
-
revokeChatInviteLink(invite_link: string, signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatInviteLink>;
|
|
513
|
+
revokeChatInviteLink(invite_link: string, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatInviteLink>;
|
|
514
514
|
/**
|
|
515
515
|
* Context-aware alias for `api.approveChatJoinRequest`. Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
|
|
516
516
|
*
|
|
@@ -606,7 +606,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
606
606
|
*
|
|
607
607
|
* **Official reference:** https://core.telegram.org/bots/api#getchat
|
|
608
608
|
*/
|
|
609
|
-
getChat(signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatFromGetChat>;
|
|
609
|
+
getChat(signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatFromGetChat>;
|
|
610
610
|
/**
|
|
611
611
|
* Context-aware alias for `api.getChatAdministrators`. Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
|
|
612
612
|
*
|
|
@@ -614,7 +614,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
614
614
|
*
|
|
615
615
|
* **Official reference:** https://core.telegram.org/bots/api#getchatadministrators
|
|
616
616
|
*/
|
|
617
|
-
getChatAdministrators(signal?: AbortSignal): Promise<import("@grammyjs/types/manage").
|
|
617
|
+
getChatAdministrators(signal?: AbortSignal): Promise<(import("@grammyjs/types/manage.js").ChatMemberOwner | import("@grammyjs/types/manage.js").ChatMemberAdministrator)[]>;
|
|
618
618
|
/** @deprecated Use `getChatMembersCount` instead. */
|
|
619
619
|
getChatMembersCount(...args: Parameters<Context["getChatMemberCount"]>): Promise<number>;
|
|
620
620
|
/**
|
|
@@ -632,7 +632,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
632
632
|
*
|
|
633
633
|
* **Official reference:** https://core.telegram.org/bots/api#getchatmember
|
|
634
634
|
*/
|
|
635
|
-
getAuthor(signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatMember>;
|
|
635
|
+
getAuthor(signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatMember>;
|
|
636
636
|
/**
|
|
637
637
|
* Context-aware alias for `api.getChatMember`. Use this method to get information about a member of a chat. Returns a ChatMember object on success.
|
|
638
638
|
*
|
|
@@ -641,7 +641,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
641
641
|
*
|
|
642
642
|
* **Official reference:** https://core.telegram.org/bots/api#getchatmember
|
|
643
643
|
*/
|
|
644
|
-
getChatMember(user_id: number, signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatMember>;
|
|
644
|
+
getChatMember(user_id: number, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatMember>;
|
|
645
645
|
/**
|
|
646
646
|
* Context-aware alias for `api.setChatStickerSet`. Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success.
|
|
647
647
|
*
|
|
@@ -687,7 +687,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
687
687
|
*
|
|
688
688
|
* **Official reference:** https://core.telegram.org/bots/api#setchatmenubutton
|
|
689
689
|
*/
|
|
690
|
-
getChatMenuButton(other?: Other<"getChatMenuButton">, signal?: AbortSignal): Promise<import("@grammyjs/types/menu-button").MenuButton>;
|
|
690
|
+
getChatMenuButton(other?: Other<"getChatMenuButton">, signal?: AbortSignal): Promise<import("@grammyjs/types/menu-button.js").MenuButton>;
|
|
691
691
|
/**
|
|
692
692
|
* Context-aware alias for `api.setMyDefaultAdministratorRights`. Use this method to the change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns True on success.
|
|
693
693
|
*
|
|
@@ -703,7 +703,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
703
703
|
* @param other Optional remaining parameters, confer the official reference below
|
|
704
704
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
705
705
|
*/
|
|
706
|
-
getMyDefaultAdministratorRights(other?: Other<"getMyDefaultAdministratorRights">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage").ChatAdministratorRights>;
|
|
706
|
+
getMyDefaultAdministratorRights(other?: Other<"getMyDefaultAdministratorRights">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").ChatAdministratorRights>;
|
|
707
707
|
/**
|
|
708
708
|
* Context-aware alias for `api.editMessageText`. Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
709
709
|
*
|
|
@@ -713,7 +713,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
713
713
|
*
|
|
714
714
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagetext
|
|
715
715
|
*/
|
|
716
|
-
editMessageText(text: string, other?: Other<"editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & import("@grammyjs/types/message").MsgWith<"text">)>;
|
|
716
|
+
editMessageText(text: string, other?: Other<"editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & import("@grammyjs/types/message.js").MsgWith<"text">)>;
|
|
717
717
|
/**
|
|
718
718
|
* Context-aware alias for `api.editMessageCaption`. Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
719
719
|
*
|
|
@@ -732,7 +732,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
732
732
|
*
|
|
733
733
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagemedia
|
|
734
734
|
*/
|
|
735
|
-
editMessageMedia(media: InputMedia, other?: Other<"editMessageMedia", "chat_id" | "message_id" | "inline_message_id" | "media">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CaptionableMessage & import("@grammyjs/types/message").MsgWith<"document"> & import("@grammyjs/types/message").MsgWith<"animation">) | (Update.Edited & Message.CaptionableMessage & import("@grammyjs/types/message").MsgWith<"audio">) | (Update.Edited & Message.CaptionableMessage & import("@grammyjs/types/message").MsgWith<"document">) | (Update.Edited & Message.MediaMessage & import("@grammyjs/types/message").MsgWith<"photo">) | (Update.Edited & Message.MediaMessage & import("@grammyjs/types/message").MsgWith<"video">)>;
|
|
735
|
+
editMessageMedia(media: InputMedia, other?: Other<"editMessageMedia", "chat_id" | "message_id" | "inline_message_id" | "media">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CaptionableMessage & import("@grammyjs/types/message.js").MsgWith<"document"> & import("@grammyjs/types/message.js").MsgWith<"animation">) | (Update.Edited & Message.CaptionableMessage & import("@grammyjs/types/message.js").MsgWith<"audio">) | (Update.Edited & Message.CaptionableMessage & import("@grammyjs/types/message.js").MsgWith<"document">) | (Update.Edited & Message.MediaMessage & import("@grammyjs/types/message.js").MsgWith<"photo">) | (Update.Edited & Message.MediaMessage & import("@grammyjs/types/message.js").MsgWith<"video">)>;
|
|
736
736
|
/**
|
|
737
737
|
* Context-aware alias for `api.editMessageReplyMarkup`. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
738
738
|
*
|
|
@@ -750,7 +750,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
750
750
|
*
|
|
751
751
|
* **Official reference:** https://core.telegram.org/bots/api#stoppoll
|
|
752
752
|
*/
|
|
753
|
-
stopPoll(other?: Other<"stopPoll", "chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message").Poll>;
|
|
753
|
+
stopPoll(other?: Other<"stopPoll", "chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Poll>;
|
|
754
754
|
/**
|
|
755
755
|
* Context-aware alias for `api.deleteMessage`. Use this method to delete a message, including service messages, with the following limitations:
|
|
756
756
|
* - A message can only be deleted if it was sent less than 48 hours ago.
|
package/out/context.js
CHANGED
|
@@ -116,7 +116,7 @@ class Context {
|
|
|
116
116
|
}
|
|
117
117
|
// AGGREGATION SHORTCUTS
|
|
118
118
|
/**
|
|
119
|
-
* Get message object from
|
|
119
|
+
* Get message object from wherever possible. Alias for `ctx.message ??
|
|
120
120
|
* ctx.editedMessage ?? ctx.callbackQuery?.message ?? ctx.channelPost ??
|
|
121
121
|
* ctx.editedChannelPost`
|
|
122
122
|
*/
|
|
@@ -126,8 +126,8 @@ class Context {
|
|
|
126
126
|
return ((_e = (_d = (_b = (_a = this.message) !== null && _a !== void 0 ? _a : this.editedMessage) !== null && _b !== void 0 ? _b : (_c = this.callbackQuery) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : this.channelPost) !== null && _e !== void 0 ? _e : this.editedChannelPost);
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
|
-
* Get chat object from
|
|
130
|
-
*
|
|
129
|
+
* Get chat object from wherever possible. Alias for `(ctx.msg ??
|
|
130
|
+
* ctx.myChatMember ?? ctx.chatMember ?? ctx.chatJoinRequest)?.chat`
|
|
131
131
|
*/
|
|
132
132
|
get chat() {
|
|
133
133
|
var _a, _b, _c, _d;
|
|
@@ -143,10 +143,10 @@ class Context {
|
|
|
143
143
|
return (_a = this.msg) === null || _a === void 0 ? void 0 : _a.sender_chat;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
* Get message author from
|
|
146
|
+
* Get message author from wherever possible. Alias for
|
|
147
147
|
* `(ctx.callbackQuery?? ctx.inlineQuery ?? ctx.shippingQuery ??
|
|
148
148
|
* ctx.preCheckoutQuery ?? ctx.chosenInlineResult ?? ctx.msg ??
|
|
149
|
-
*
|
|
149
|
+
* ctx.myChatMember ?? ctx.chatMember ?? ctx.chatJoinRequest)?.from`
|
|
150
150
|
*/
|
|
151
151
|
get from() {
|
|
152
152
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -154,7 +154,7 @@ class Context {
|
|
|
154
154
|
return (_j = ((_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = this.callbackQuery) !== null && _a !== void 0 ? _a : this.inlineQuery) !== null && _b !== void 0 ? _b : this.shippingQuery) !== null && _c !== void 0 ? _c : this.preCheckoutQuery) !== null && _d !== void 0 ? _d : this.chosenInlineResult) !== null && _e !== void 0 ? _e : this.msg) !== null && _f !== void 0 ? _f : this.myChatMember) !== null && _g !== void 0 ? _g : this.chatMember) !== null && _h !== void 0 ? _h : this.chatJoinRequest)) === null || _j === void 0 ? void 0 : _j.from;
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
* Get inline message ID from
|
|
157
|
+
* Get inline message ID from wherever possible. Alias for
|
|
158
158
|
* `(ctx.callbackQuery ?? ctx.chosenInlineResult)?.inline_message_id`
|
|
159
159
|
*/
|
|
160
160
|
get inlineMessageId() {
|
|
@@ -3,38 +3,52 @@ import { type IncomingMessage, type ServerResponse } from "http";
|
|
|
3
3
|
export declare const adapters: {
|
|
4
4
|
http: (req: IncomingMessage, res: ServerResponse) => {
|
|
5
5
|
update: Promise<any>;
|
|
6
|
+
header: string;
|
|
6
7
|
end: () => ServerResponse;
|
|
7
8
|
respond: (json: string) => ServerResponse;
|
|
9
|
+
unauthorized: () => ServerResponse;
|
|
8
10
|
};
|
|
9
11
|
https: (req: IncomingMessage, res: ServerResponse) => {
|
|
10
12
|
update: Promise<any>;
|
|
13
|
+
header: string;
|
|
11
14
|
end: () => ServerResponse;
|
|
12
15
|
respond: (json: string) => ServerResponse;
|
|
16
|
+
unauthorized: () => ServerResponse;
|
|
13
17
|
};
|
|
14
18
|
express: (req: any, res: any) => {
|
|
15
19
|
update: Promise<any>;
|
|
20
|
+
header: any;
|
|
16
21
|
end: () => any;
|
|
17
22
|
respond: (json: string) => void;
|
|
23
|
+
unauthorized: () => void;
|
|
18
24
|
};
|
|
19
25
|
koa: (ctx: any) => {
|
|
20
26
|
update: Promise<any>;
|
|
27
|
+
header: any;
|
|
21
28
|
end: () => void;
|
|
22
29
|
respond: (json: string) => void;
|
|
30
|
+
unauthorized: () => void;
|
|
23
31
|
};
|
|
24
32
|
fastify: (req: any, reply: any) => {
|
|
25
33
|
update: Promise<any>;
|
|
34
|
+
header: any;
|
|
26
35
|
end: () => any;
|
|
27
36
|
respond: (json: string) => any;
|
|
37
|
+
unauthorized: () => any;
|
|
28
38
|
};
|
|
29
39
|
worktop: (req: any, res: any) => {
|
|
30
40
|
update: Promise<any>;
|
|
41
|
+
header: any;
|
|
31
42
|
end: () => any;
|
|
32
43
|
respond: (json: string) => any;
|
|
44
|
+
unauthorized: () => any;
|
|
33
45
|
};
|
|
34
46
|
"aws-lambda": (event: any, _context: any, callback: any) => {
|
|
35
47
|
update: any;
|
|
48
|
+
header: any;
|
|
36
49
|
end: () => any;
|
|
37
50
|
respond: (json: string) => any;
|
|
51
|
+
unauthorized: () => any;
|
|
38
52
|
};
|
|
39
53
|
};
|
|
40
54
|
export declare const defaultAdapter = "express";
|