grammy 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # <h1 align="center"> [![grammY](https://raw.githubusercontent.com/grammyjs/website/main/logos/grammY.png)](https://grammy.dev)</h1>
1
+ <div align="center"><a href="https://grammy.dev"><img src="https://raw.githubusercontent.com/grammyjs/website/main/logos/grammY.png" alt="grammY"></a></h1></div>
2
2
 
3
- **<h1 align="right">The Telegram Bot Framework.</h1>**
3
+ <div align="right">
4
4
 
5
- ---
5
+ # The Telegram Bot Framework.
6
6
 
7
- _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_curl: API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts) | [:busts_in_silhouette: Group Chat](https://telegram.me/grammyjs) | [:new: News](https://telegram.me/grammyjs_news)</h2>_
7
+ </div>
8
8
 
9
9
  <div align="center">
10
10
 
@@ -17,6 +17,8 @@ _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_cur
17
17
 
18
18
  <!-- deno-fmt-ignore-end -->
19
19
 
20
+ ## _[docs.](https://grammy.dev) [reference.](https://doc.deno.land/https://deno.land/x/grammy/mod.ts) [chat.](https://telegram.me/grammyjs) [news.](https://telegram.me/grammyjs_news)_
21
+
20
22
  </div>
21
23
 
22
24
  **grammY makes it easy to create Telegram bots.** Both for beginners and at scale.
@@ -77,24 +79,29 @@ Here are some more resources to support you:
77
79
  ### [grammY Website](https://grammy.dev)
78
80
 
79
81
  —main project website and documentation.
82
+ Gets you started and explains all concepts.
80
83
 
81
84
  ### [grammY API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts)
82
85
 
83
86
  —reference of everything that grammY exports.
87
+ Useful to look up descriptions about any element of grammY.
84
88
 
85
89
  ### [grammY Example Bots](https://github.com/grammyjs/examples)
86
90
 
87
- —repository full of example bots. Includes a setup to easily run any of them.
91
+ —repository full of example bots.
92
+ Includes a setup to easily run any of them.
88
93
 
89
94
  ### [grammY Telegram Chat](https://t.me/grammyjs)
90
95
 
91
- —Telegram chat where you can ask any question about grammY or bots in general. We are also open for feedback, ideas, and contributions!
96
+ —Telegram chat where you can ask any question about grammY or bots in general.
97
+ We are also open for feedback, ideas, and contributions!
92
98
 
93
99
  The Russian commnity chat can be found [here](https://t.me/grammyjs_ru).
94
100
 
95
101
  ### [grammY News Channel](https://t.me/grammyjs_news)
96
102
 
97
103
  —Telegram channel where updates to grammY and the ecosystem are posted.
104
+ We are also [on Twitter](https://twitter.com/grammy_js).
98
105
 
99
106
  ### [Telegram Bot API Reference](https://core.telegram.org/bots/api)
100
107
 
@@ -130,7 +137,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
130
137
  <table>
131
138
  <tr>
132
139
  <td align="center"><a href="https://github.com/KnorpelSenf"><img src="https://avatars.githubusercontent.com/u/12952387?v=4?s=100" width="100px;" alt=""/><br /><sub><b>KnorpelSenf</b></sub></a><br /><a href="#ideas-KnorpelSenf" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnorpelSenf" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnorpelSenf" title="Documentation">📖</a> <a href="#design-KnorpelSenf" title="Design">🎨</a> <a href="#example-KnorpelSenf" title="Examples">💡</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnorpelSenf" title="Tests">⚠️</a> <a href="#plugin-KnorpelSenf" title="Plugin/utility libraries">🔌</a> <a href="#platform-KnorpelSenf" title="Packaging/porting to new platform">📦</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AKnorpelSenf" title="Reviewed Pull Requests">👀</a> <a href="#mentoring-KnorpelSenf" title="Mentoring">🧑‍🏫</a> <a href="#projectManagement-KnorpelSenf" title="Project Management">📆</a> <a href="#infra-KnorpelSenf" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
133
- <td align="center"><a href="https://github.com/Tecardo1"><img src="https://avatars.githubusercontent.com/u/42873000?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tecardo1</b></sub></a><br /><a href="#plugin-Tecardo1" title="Plugin/utility libraries">🔌</a> <a href="#userTesting-Tecardo1" title="User Testing">📓</a> <a href="#example-Tecardo1" title="Examples">💡</a> <a href="https://github.com/grammyjs/grammY/commits?author=Tecardo1" title="Documentation">📖</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3ATecardo1" title="Reviewed Pull Requests">👀</a></td>
140
+ <td align="center"><a href="https://github.com/HeeroML"><img src="https://avatars.githubusercontent.com/u/42873000?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heero</b></sub></a><br /><a href="#plugin-HeeroML" title="Plugin/utility libraries">🔌</a> <a href="#userTesting-HeeroML" title="User Testing">📓</a> <a href="#example-HeeroML" title="Examples">💡</a> <a href="https://github.com/grammyjs/grammY/commits?author=HeeroML" title="Documentation">📖</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AHeeroML" title="Reviewed Pull Requests">👀</a></td>
134
141
  <td align="center"><a href="https://github.com/wojpawlik"><img src="https://avatars.githubusercontent.com/u/23058303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Wojciech Pawlik</b></sub></a><br /><a href="#ideas-wojpawlik" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Awojpawlik" title="Reviewed Pull Requests">👀</a> <a href="#infra-wojpawlik" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#platform-wojpawlik" title="Packaging/porting to new platform">📦</a> <a href="#tool-wojpawlik" title="Tools">🔧</a></td>
135
142
  <td align="center"><a href="https://github.com/MegaITA"><img src="https://avatars.githubusercontent.com/u/32493080?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alessandro Bertozzi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=MegaITA" title="Documentation">📖</a></td>
136
143
  <td align="center"><a href="https://trgwii.no/"><img src="https://avatars.githubusercontent.com/u/11262022?v=4?s=100" width="100px;" alt=""/><br /><sub><b>trgwii</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=trgwii" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Atrgwii" title="Reviewed Pull Requests">👀</a></td>
@@ -144,11 +151,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
144
151
  <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
152
  <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
153
  <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> <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>
154
+ <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> <a href="https://github.com/grammyjs/grammY/commits?author=Loskir" title="Code">💻</a> <a href="#plugin-Loskir" title="Plugin/utility libraries">🔌</a></td>
148
155
  </tr>
149
156
  <tr>
150
157
  <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>
151
- <td align="center"><a href="https://github.com/code-withAshish"><img src="https://avatars.githubusercontent.com/u/73625149?v=4?s=100" width="100px;" alt=""/><br /><sub><b>code-withAshish</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=code-withAshish" title="Documentation">📖</a></td>
158
+ <td align="center"><a href="https://github.com/code-withAshish"><img src="https://avatars.githubusercontent.com/u/73625149?v=4?s=100" width="100px;" alt=""/><br /><sub><b>code-withAshish</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=code-withAshish" title="Documentation">📖</a> <a href="#question-code-withAshish" title="Answering Questions">💬</a></td>
152
159
  <td align="center"><a href="https://beta.ku-di.com/waptik"><img src="https://avatars.githubusercontent.com/u/1687551?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stephane Mensah</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Awaptik" title="Bug reports">🐛</a> <a href="#plugin-waptik" title="Plugin/utility libraries">🔌</a></td>
153
160
  <td align="center"><a href="https://github.com/Asaku01"><img src="https://avatars.githubusercontent.com/u/29716396?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Asaku01</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Asaku01" title="Documentation">📖</a></td>
154
161
  <td align="center"><a href="https://github.com/ppsimn"><img src="https://avatars.githubusercontent.com/u/88509883?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ppsimn</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Appsimn" title="Bug reports">🐛</a></td>
@@ -171,13 +178,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
171
178
  <td align="center"><a href="https://zhemu.buzz/"><img src="https://avatars.githubusercontent.com/u/56839018?v=4?s=100" width="100px;" alt=""/><br /><sub><b>linbuxiao</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=linbuxiao" title="Documentation">📖</a> <a href="#translation-linbuxiao" title="Translation">🌍</a></td>
172
179
  <td align="center"><a href="https://github.com/JiquanWang99"><img src="https://avatars.githubusercontent.com/u/63894579?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JiquanWang99</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=JiquanWang99" title="Documentation">📖</a> <a href="#translation-JiquanWang99" title="Translation">🌍</a></td>
173
180
  <td align="center"><a href="http://bor691.ir/"><img src="https://avatars.githubusercontent.com/u/4184939?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Borhan Hafez</b></sub></a><br /><a href="#plugin-zumoshi" title="Plugin/utility libraries">🔌</a></td>
174
- <td align="center"><a href="https://blog.limx.dev/"><img src="https://avatars.githubusercontent.com/u/6434137?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WingLim</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=WingLim" title="Documentation">📖</a> <a href="#translation-WingLim" title="Translation">🌍</a></td>
181
+ <td align="center"><a href="https://blog.limx.dev/"><img src="https://avatars.githubusercontent.com/u/6434137?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WingLim</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=WingLim" title="Documentation">📖</a> <a href="#translation-WingLim" title="Translation">🌍</a> <a href="https://github.com/grammyjs/grammY/commits?author=WingLim" title="Code">💻</a> <a href="#plugin-WingLim" title="Plugin/utility libraries">🔌</a> <a href="#ideas-WingLim" title="Ideas, Planning, & Feedback">🤔</a></td>
175
182
  </tr>
176
183
  <tr>
177
184
  <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
185
  <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
186
  <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> <a href="#ideas-dcdunkan" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-dcdunkan" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
187
+ <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> <a href="#tool-dcdunkan" title="Tools">🔧</a></td>
181
188
  <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
189
  <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
190
  <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>
@@ -197,7 +204,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
197
204
  <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
205
  <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
206
  <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>
207
+ <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> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AC0rn3j" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AC0rn3j" title="Reviewed Pull Requests">👀</a></td>
201
208
  <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
209
  </tr>
203
210
  <tr>
@@ -206,6 +213,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
206
213
  <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
214
  <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
215
  <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>
216
+ <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>
217
+ <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>
218
+ </tr>
219
+ <tr>
220
+ <td align="center"><a href="http://roz.ninja"><img src="https://avatars.githubusercontent.com/u/3948961?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roz</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aroziscoding" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=roziscoding" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Aroziscoding" title="Reviewed Pull Requests">👀</a></td>
221
+ <td align="center"><a href="https://github.com/daniharo"><img src="https://avatars.githubusercontent.com/u/47931084?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dani Haro</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=daniharo" title="Code">💻</a> <a href="#plugin-daniharo" title="Plugin/utility libraries">🔌</a> <a href="https://github.com/grammyjs/grammY/commits?author=daniharo" title="Documentation">📖</a></td>
222
+ <td align="center"><a href="https://github.com/Ryukaizen"><img src="https://avatars.githubusercontent.com/u/55140313?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryukaizen</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Ryukaizen" title="Documentation">📖</a></td>
209
223
  </tr>
210
224
  </table>
211
225
 
package/out/bot.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BotError, Composer } from "./composer.js";
2
2
  import { Context } from "./context.js";
3
3
  import { Api } from "./core/api.js";
4
4
  import { type ApiClientOptions, type WebhookReplyEnvelope } from "./core/client.js";
5
- import { type Update, type UserFromGetMe } from "./platform.node.js";
5
+ import { type Update, type UserFromGetMe } from "./types.js";
6
6
  /**
7
7
  * Options that can be specified when running the bot via simple long polling.
8
8
  */
package/out/composer.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { type AliasProps, type Context } from "./context.js";
2
- import { type Filter, type FilterQuery } from "./filter.js";
3
- import { type Chat } from "./platform.node.js";
1
+ import { type CallbackQueryContext, type ChatTypeContext, type CommandContext, Context, type GameQueryContext, type HearsContext, type InlineQueryContext, type MaybeArray, type StringWithSuggestions } from "./context.js";
2
+ import { Filter, FilterQuery } from "./filter.js";
3
+ import { type Chat } from "./types.js";
4
4
  declare type MaybePromise<T> = T | Promise<T>;
5
- declare type MaybeArray<T> = T | T[];
6
- declare type StringWithSuggestions<S extends string> = (string & {}) | S;
7
5
  /**
8
6
  * A function of this type is passed as the second parameter to all middleware.
9
7
  * Invoke it to call the downstream middleware and pass on the control flow.
@@ -586,27 +584,58 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
586
584
  */
587
585
  errorBoundary(errorHandler: (error: BotError<C>, next: NextFunction) => MaybePromise<unknown>, ...middleware: Array<Middleware<C>>): Composer<C>;
588
586
  }
589
- export declare type HearsContext<C extends Context> = Filter<Omit<C, "match"> & {
590
- match: Extract<C["match"], string | RegExpMatchArray>;
591
- }, ":text" | ":caption">;
592
- export declare type CommandContext<C extends Context> = Filter<Omit<C, "match"> & {
593
- match: Extract<C["match"], string>;
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
- }
587
+ /**
588
+ * Type of the middleware that can be passed to `bot.hears`.
589
+ *
590
+ * This helper type can be used to annotate middleware functions that are
591
+ * defined in one place, so that they have the correct type when passed to
592
+ * `bot.hears` in a different place. For instance, this allows for more modular
593
+ * code where handlers are defined in separate files.
594
+ */
606
595
  export declare type HearsMiddleware<C extends Context> = Middleware<HearsContext<C>>;
596
+ /**
597
+ * Type of the middleware that can be passed to `bot.command`.
598
+ *
599
+ * This helper type can be used to annotate middleware functions that are
600
+ * defined in one place, so that they have the correct type when passed to
601
+ * `bot.command` in a different place. For instance, this allows for more
602
+ * modular code where handlers are defined in separate files.
603
+ */
607
604
  export declare type CommandMiddleware<C extends Context> = Middleware<CommandContext<C>>;
605
+ /**
606
+ * Type of the middleware that can be passed to `bot.callbackQuery`.
607
+ *
608
+ * This helper type can be used to annotate middleware functions that are
609
+ * defined in one place, so that they have the correct type when passed to
610
+ * `bot.callbackQuery` in a different plac For instance, this allows for more
611
+ * modular code where handlers are defined in separate files.e.
612
+ */
608
613
  export declare type CallbackQueryMiddleware<C extends Context> = Middleware<CallbackQueryContext<C>>;
614
+ /**
615
+ * Type of the middleware that can be passed to `bot.gameQuery`.
616
+ *
617
+ * This helper type can be used to annotate middleware functions that are
618
+ * defined in one place, so that they have the correct type when passed to
619
+ * `bot.gameQuery` in a different place. For instance, this allows for more
620
+ * modular code where handlers are defined in separate files.
621
+ */
609
622
  export declare type GameQueryMiddleware<C extends Context> = Middleware<GameQueryContext<C>>;
623
+ /**
624
+ * Type of the middleware that can be passed to `bot.inlineQuery`.
625
+ *
626
+ * This helper type can be used to annotate middleware functions that are
627
+ * defined in one place, so that they have the correct type when passed to
628
+ * `bot.inlineQuery` in a different place. For instance, this allows for more
629
+ * modular code where handlers are defined in separate files.
630
+ */
610
631
  export declare type InlineQueryMiddleware<C extends Context> = Middleware<InlineQueryContext<C>>;
632
+ /**
633
+ * Type of the middleware that can be passed to `bot.chatType`.
634
+ *
635
+ * This helper type can be used to annotate middleware functions that are
636
+ * defined in one place, so that they have the correct type when passed to
637
+ * `bot.chatType` in a different place. For instance, this allows for more
638
+ * modular code where handlers are defined in separate files.
639
+ */
611
640
  export declare type ChatTypeMiddleware<C extends Context, T extends Chat["type"]> = Middleware<ChatTypeContext<C, T>>;
612
641
  export {};
package/out/composer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Composer = exports.run = exports.BotError = void 0;
4
- const filter_js_1 = require("./filter.js");
4
+ const context_js_1 = require("./context.js");
5
5
  // === Middleware errors
6
6
  /**
7
7
  * This error is thrown when middleware throws. It simply wraps the original
@@ -181,7 +181,7 @@ class Composer {
181
181
  * @param middleware The middleware to register behind the given filter
182
182
  */
183
183
  on(filter, ...middleware) {
184
- return this.filter((0, filter_js_1.matchFilter)(filter), ...middleware);
184
+ return this.filter(context_js_1.Context.has.filterQuery(filter), ...middleware);
185
185
  }
186
186
  /**
187
187
  * Registers some middleware that will only be executed when the message
@@ -215,13 +215,7 @@ class Composer {
215
215
  * @param middleware The middleware to register
216
216
  */
217
217
  hears(trigger, ...middleware) {
218
- const trg = triggerFn(trigger);
219
- return this.on([":text", ":caption"]).filter((ctx) => {
220
- var _a, _b;
221
- const msg = (_a = ctx.message) !== null && _a !== void 0 ? _a : ctx.channelPost;
222
- const txt = (_b = msg.text) !== null && _b !== void 0 ? _b : msg.caption;
223
- return match(ctx, txt, trg);
224
- }, ...middleware);
218
+ return this.filter(context_js_1.Context.has.text(trigger), ...middleware);
225
219
  }
226
220
  /**
227
221
  * Registers some middleware that will only be executed when a certain
@@ -279,43 +273,7 @@ class Composer {
279
273
  * @param middleware The middleware to register
280
274
  */
281
275
  command(command, ...middleware) {
282
- const atCommands = new Set();
283
- const noAtCommands = new Set();
284
- toArray(command).forEach((cmd) => {
285
- if (cmd.startsWith("/")) {
286
- throw new Error(`Do not include '/' when registering command handlers (use '${cmd.substring(1)}' not '${cmd}')`);
287
- }
288
- const set = cmd.indexOf("@") === -1 ? noAtCommands : atCommands;
289
- set.add(cmd);
290
- });
291
- return this.on(":entities:bot_command").filter((ctx) => {
292
- var _a;
293
- const msg = (_a = ctx.message) !== null && _a !== void 0 ? _a : ctx.channelPost;
294
- const txt = msg.text;
295
- return msg.entities.some((e) => {
296
- if (e.type !== "bot_command")
297
- return false;
298
- if (e.offset !== 0)
299
- return false;
300
- const cmd = txt.substring(1, e.length);
301
- if (noAtCommands.has(cmd) || atCommands.has(cmd)) {
302
- ctx.match = txt.substring(cmd.length + 1).trimStart();
303
- return true;
304
- }
305
- const index = cmd.indexOf("@");
306
- if (index === -1)
307
- return false;
308
- const atTarget = cmd.substring(index + 1);
309
- if (atTarget !== ctx.me.username)
310
- return false;
311
- const atCommand = cmd.substring(0, index);
312
- if (noAtCommands.has(atCommand)) {
313
- ctx.match = txt.substring(cmd.length + 1).trimStart();
314
- return true;
315
- }
316
- return false;
317
- });
318
- }, ...middleware);
276
+ return this.filter(context_js_1.Context.has.command(command), ...middleware);
319
277
  }
320
278
  /**
321
279
  * Registers some middleware for certain chat types only. For example, you
@@ -349,8 +307,7 @@ class Composer {
349
307
  * @param middleware The middleware to register
350
308
  */
351
309
  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);
310
+ return this.filter(context_js_1.Context.has.chatType(chatType), ...middleware);
354
311
  }
355
312
  /**
356
313
  * Registers some middleware for callback queries, i.e. the updates that
@@ -393,8 +350,7 @@ class Composer {
393
350
  * @param middleware The middleware to register
394
351
  */
395
352
  callbackQuery(trigger, ...middleware) {
396
- const trg = triggerFn(trigger);
397
- return this.on("callback_query:data").filter((ctx) => match(ctx, ctx.callbackQuery.data, trg), ...middleware);
353
+ return this.filter(context_js_1.Context.has.callbackQuery(trigger), ...middleware);
398
354
  }
399
355
  /**
400
356
  * Registers some middleware for game queries, i.e. the updates that
@@ -415,8 +371,7 @@ class Composer {
415
371
  * @param middleware The middleware to register
416
372
  */
417
373
  gameQuery(trigger, ...middleware) {
418
- const trg = triggerFn(trigger);
419
- return this.on("callback_query:game_short_name").filter((ctx) => match(ctx, ctx.callbackQuery.game_short_name, trg), ...middleware);
374
+ return this.filter(context_js_1.Context.has.gameQuery(trigger), ...middleware);
420
375
  }
421
376
  /**
422
377
  * Registers middleware for inline queries. Telegram sends an inline query
@@ -441,8 +396,7 @@ class Composer {
441
396
  * @param middleware The middleware to register
442
397
  */
443
398
  inlineQuery(trigger, ...middleware) {
444
- const trg = triggerFn(trigger);
445
- return this.on("inline_query").filter((ctx) => match(ctx, ctx.inlineQuery.query, trg), ...middleware);
399
+ return this.filter(context_js_1.Context.has.inlineQuery(trigger), ...middleware);
446
400
  }
447
401
  filter(predicate, ...middleware) {
448
402
  const composer = new Composer(...middleware);
@@ -525,7 +479,7 @@ class Composer {
525
479
  lazy(middlewareFactory) {
526
480
  return this.use(async (ctx, next) => {
527
481
  const middleware = await middlewareFactory(ctx);
528
- const arr = toArray(middleware);
482
+ const arr = Array.isArray(middleware) ? middleware : [middleware];
529
483
  await flatten(new Composer(...arr))(ctx, next);
530
484
  });
531
485
  }
@@ -653,22 +607,3 @@ class Composer {
653
607
  }
654
608
  }
655
609
  exports.Composer = Composer;
656
- // === Util functions
657
- function triggerFn(trigger) {
658
- return toArray(trigger).map((t) => typeof t === "string"
659
- ? (txt) => (txt === t ? t : null)
660
- : (txt) => txt.match(t));
661
- }
662
- function match(ctx, content, triggers) {
663
- for (const t of triggers) {
664
- const res = t(content);
665
- if (res) {
666
- ctx.match = res;
667
- return true;
668
- }
669
- }
670
- return false;
671
- }
672
- function toArray(e) {
673
- return Array.isArray(e) ? e : [e];
674
- }