ferogram 0.2.0__tar.gz → 0.2.2__tar.gz

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 (94) hide show
  1. {ferogram-0.2.0 → ferogram-0.2.2}/Cargo.lock +23 -23
  2. {ferogram-0.2.0 → ferogram-0.2.2}/Cargo.toml +2 -2
  3. {ferogram-0.2.0 → ferogram-0.2.2}/FEATURES.md +34 -33
  4. {ferogram-0.2.0 → ferogram-0.2.2}/PKG-INFO +1 -1
  5. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/__init__.py +2 -1
  6. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/codegen.py +28 -3
  7. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/__init__.py +2 -1
  8. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/_tl_schema.py +61 -17
  9. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/__init__.py +5 -2
  10. ferogram-0.2.2/ferogram/raw/generated/functions/aicompose.py +173 -0
  11. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/bots.py +44 -2
  12. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/contacts.py +5 -2
  13. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/messages.py +101 -5
  14. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/stats.py +26 -2
  15. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/__init__.py +5 -2
  16. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/_base.py +245 -4
  17. ferogram-0.2.2/ferogram/raw/generated/types/aicompose.py +58 -0
  18. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/auth.py +5 -2
  19. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/bots.py +23 -2
  20. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/stats.py +20 -2
  21. {ferogram-0.2.0 → ferogram-0.2.2}/pyproject.toml +1 -1
  22. {ferogram-0.2.0 → ferogram-0.2.2}/src/client.rs +88 -7
  23. {ferogram-0.2.0 → ferogram-0.2.2}/src/lib.rs +2 -0
  24. {ferogram-0.2.0 → ferogram-0.2.2}/src/updates.rs +28 -0
  25. {ferogram-0.2.0 → ferogram-0.2.2}/.github/workflows/publish.yml +0 -0
  26. {ferogram-0.2.0 → ferogram-0.2.2}/.gitignore +0 -0
  27. {ferogram-0.2.0 → ferogram-0.2.2}/LICENSE-APACHE +0 -0
  28. {ferogram-0.2.0 → ferogram-0.2.2}/LICENSE-MIT +0 -0
  29. {ferogram-0.2.0 → ferogram-0.2.2}/README.md +0 -0
  30. {ferogram-0.2.0 → ferogram-0.2.2}/examples/admin_tools.py +0 -0
  31. {ferogram-0.2.0 → ferogram-0.2.2}/examples/command_bot.py +0 -0
  32. {ferogram-0.2.0 → ferogram-0.2.2}/examples/echo_bot.py +0 -0
  33. {ferogram-0.2.0 → ferogram-0.2.2}/examples/group_management.py +0 -0
  34. {ferogram-0.2.0 → ferogram-0.2.2}/examples/media_bot.py +0 -0
  35. {ferogram-0.2.0 → ferogram-0.2.2}/examples/raw_invoke.py +0 -0
  36. {ferogram-0.2.0 → ferogram-0.2.2}/examples/search_bot.py +0 -0
  37. {ferogram-0.2.0 → ferogram-0.2.2}/examples/send_hi.py +0 -0
  38. {ferogram-0.2.0 → ferogram-0.2.2}/examples/send_media.py +0 -0
  39. {ferogram-0.2.0 → ferogram-0.2.2}/examples/send_message.py +0 -0
  40. {ferogram-0.2.0 → ferogram-0.2.2}/examples/update_handlers.py +0 -0
  41. {ferogram-0.2.0 → ferogram-0.2.2}/examples/user_management.py +0 -0
  42. {ferogram-0.2.0 → ferogram-0.2.2}/examples/userbot.py +0 -0
  43. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/__init__.py +0 -0
  44. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/client.py +0 -0
  45. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/filters.py +0 -0
  46. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/logging.py +0 -0
  47. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/py.typed +0 -0
  48. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/api/__init__.py +0 -0
  49. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/api/functions.py +0 -0
  50. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/api/types.py +0 -0
  51. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/account.py +2 -2
  52. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/auth.py +2 -2
  53. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/channels.py +2 -2
  54. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/chatlists.py +2 -2
  55. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/folders.py +2 -2
  56. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/fragment.py +2 -2
  57. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/help.py +2 -2
  58. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/langpack.py +2 -2
  59. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/payments.py +2 -2
  60. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/phone.py +2 -2
  61. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/photos.py +2 -2
  62. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/premium.py +2 -2
  63. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/smsjobs.py +2 -2
  64. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/stickers.py +2 -2
  65. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/stories.py +2 -2
  66. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/updates.py +2 -2
  67. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/upload.py +2 -2
  68. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/functions/users.py +2 -2
  69. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/account.py +2 -2
  70. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/channels.py +2 -2
  71. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/chatlists.py +2 -2
  72. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/contacts.py +2 -2
  73. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/fragment.py +2 -2
  74. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/help.py +2 -2
  75. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/messages.py +2 -2
  76. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/payments.py +2 -2
  77. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/phone.py +2 -2
  78. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/photos.py +2 -2
  79. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/premium.py +2 -2
  80. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/smsjobs.py +2 -2
  81. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/stickers.py +2 -2
  82. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/storage.py +2 -2
  83. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/stories.py +2 -2
  84. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/updates.py +2 -2
  85. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/upload.py +2 -2
  86. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/generated/types/users.py +2 -2
  87. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/proxy.py +0 -0
  88. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw/tl.py +0 -0
  89. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/raw_api.tl +0 -0
  90. {ferogram-0.2.0 → ferogram-0.2.2}/ferogram/types.py +0 -0
  91. {ferogram-0.2.0 → ferogram-0.2.2}/src/auth.rs +0 -0
  92. {ferogram-0.2.0 → ferogram-0.2.2}/src/message.rs +0 -0
  93. {ferogram-0.2.0 → ferogram-0.2.2}/src/raw.rs +0 -0
  94. {ferogram-0.2.0 → ferogram-0.2.2}/src/types.rs +0 -0
@@ -274,9 +274,9 @@ dependencies = [
274
274
 
275
275
  [[package]]
276
276
  name = "ferogram"
277
- version = "0.3.8"
277
+ version = "0.4.0"
278
278
  source = "registry+https://github.com/rust-lang/crates.io-index"
279
- checksum = "532d1f9f37f3579db6e95c22e40231eff18ba4f20820ae38b7a75a6459466922"
279
+ checksum = "08d5a9e0d5162e8eb981904b15c41d7f3089640632d51a3ffcab7713c4df409b"
280
280
  dependencies = [
281
281
  "async-trait",
282
282
  "base64",
@@ -314,9 +314,9 @@ dependencies = [
314
314
 
315
315
  [[package]]
316
316
  name = "ferogram-connect"
317
- version = "0.3.8"
317
+ version = "0.4.0"
318
318
  source = "registry+https://github.com/rust-lang/crates.io-index"
319
- checksum = "736861a82c40ba25195d1037463d54ec4e329f9b1e235e8bbe360678a861eaae"
319
+ checksum = "8cdc49607faad2862b676b010b02e27d13ba2047d2253362cdf958c10efff92a"
320
320
  dependencies = [
321
321
  "ferogram-crypto",
322
322
  "ferogram-mtproto",
@@ -334,9 +334,9 @@ dependencies = [
334
334
 
335
335
  [[package]]
336
336
  name = "ferogram-crypto"
337
- version = "0.3.8"
337
+ version = "0.4.0"
338
338
  source = "registry+https://github.com/rust-lang/crates.io-index"
339
- checksum = "db48b92a5c0ee7462a2a921a2c0bdd24fbc43a6e5ed96d79c19cc2534831f1e7"
339
+ checksum = "d9df71920e40c6b6938df3ac0f4e85fe13968b48f0cbb0d0c06d98020384b02b"
340
340
  dependencies = [
341
341
  "aes",
342
342
  "ctr",
@@ -349,9 +349,9 @@ dependencies = [
349
349
 
350
350
  [[package]]
351
351
  name = "ferogram-fsm"
352
- version = "0.3.8"
352
+ version = "0.4.0"
353
353
  source = "registry+https://github.com/rust-lang/crates.io-index"
354
- checksum = "b5ab042df109225226c6d0e679de054bf68154bd1a851ec7f0cfc2ca3fb420fc"
354
+ checksum = "751b3d201d60c38679fb363022bc65646144943b79bc17e37997d8738e2f5143"
355
355
  dependencies = [
356
356
  "async-trait",
357
357
  "dashmap",
@@ -362,9 +362,9 @@ dependencies = [
362
362
 
363
363
  [[package]]
364
364
  name = "ferogram-mtproto"
365
- version = "0.3.8"
365
+ version = "0.4.0"
366
366
  source = "registry+https://github.com/rust-lang/crates.io-index"
367
- checksum = "ab166b411950c2493b8da16ac12512e9ae17aecb7efee3f53be12b4b0c558462"
367
+ checksum = "b4aa9b9d4bf5a80270e8ee81e65055c8ed7de9b4887df7d94de48d18564c692c"
368
368
  dependencies = [
369
369
  "ferogram-crypto",
370
370
  "ferogram-tl-types",
@@ -377,9 +377,9 @@ dependencies = [
377
377
 
378
378
  [[package]]
379
379
  name = "ferogram-mtsender"
380
- version = "0.3.8"
380
+ version = "0.4.0"
381
381
  source = "registry+https://github.com/rust-lang/crates.io-index"
382
- checksum = "57b0dc5058983f9662555436af85cf33f0a30aefdd1896a0f74379f4ce3725cc"
382
+ checksum = "c577e17c573111afe208b935c0a91ab51ab4df4040366010b3b4418d1fbdfecc"
383
383
  dependencies = [
384
384
  "ferogram-connect",
385
385
  "ferogram-crypto",
@@ -397,9 +397,9 @@ dependencies = [
397
397
 
398
398
  [[package]]
399
399
  name = "ferogram-parsers"
400
- version = "0.3.8"
400
+ version = "0.4.0"
401
401
  source = "registry+https://github.com/rust-lang/crates.io-index"
402
- checksum = "ae3bff00615fe04f7194b3392329877217183f45fe4eea88c4f13316d2238477"
402
+ checksum = "2616847253ad2b3c90b18f18d8f9239275c295a378ed4cd24bddaec50df3550e"
403
403
  dependencies = [
404
404
  "ferogram-tl-types",
405
405
  "pulldown-cmark",
@@ -407,7 +407,7 @@ dependencies = [
407
407
 
408
408
  [[package]]
409
409
  name = "ferogram-py"
410
- version = "0.2.0"
410
+ version = "0.2.2"
411
411
  dependencies = [
412
412
  "ferogram",
413
413
  "hex",
@@ -418,9 +418,9 @@ dependencies = [
418
418
 
419
419
  [[package]]
420
420
  name = "ferogram-session"
421
- version = "0.3.8"
421
+ version = "0.4.0"
422
422
  source = "registry+https://github.com/rust-lang/crates.io-index"
423
- checksum = "a33e4d826504cc88a184045ee375daec7df0e8193cc5495633e1001f76ee7829"
423
+ checksum = "de8ac1fbffd7bb698fe3d78038edae17544220d2cf41fe583304efa61a551e94"
424
424
  dependencies = [
425
425
  "base64",
426
426
  "tracing",
@@ -428,24 +428,24 @@ dependencies = [
428
428
 
429
429
  [[package]]
430
430
  name = "ferogram-tl-gen"
431
- version = "0.3.8"
431
+ version = "0.4.0"
432
432
  source = "registry+https://github.com/rust-lang/crates.io-index"
433
- checksum = "a3791ca624d86bdf1d2cfee99d4238cfd9fbc9559cef4e1a089b12a7648e9ce3"
433
+ checksum = "f9278407f5912be09141fa7827e39dd72851213ecf4b7c1462094a1012ffdef9"
434
434
  dependencies = [
435
435
  "ferogram-tl-parser",
436
436
  ]
437
437
 
438
438
  [[package]]
439
439
  name = "ferogram-tl-parser"
440
- version = "0.3.8"
440
+ version = "0.4.0"
441
441
  source = "registry+https://github.com/rust-lang/crates.io-index"
442
- checksum = "97a4c074abe63bc6bef7fe46796e75e9b08126cbec9debe2082a8774b15204a2"
442
+ checksum = "a2a592a2437f71ddda9ba45971bb70019c16a4cf5dd9afe941a7125232db1ff8"
443
443
 
444
444
  [[package]]
445
445
  name = "ferogram-tl-types"
446
- version = "0.3.8"
446
+ version = "0.4.0"
447
447
  source = "registry+https://github.com/rust-lang/crates.io-index"
448
- checksum = "68ef7eab10bb0f30e6ccb1cfc8d24bc67036a4cd7197b9abd0798a6b229e6fd2"
448
+ checksum = "f1b23759e460988fda70e73ed25ae4bf633e3430c60f8fbe4620198536238bd7"
449
449
  dependencies = [
450
450
  "ferogram-tl-gen",
451
451
  "ferogram-tl-parser",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "ferogram-py"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  edition = "2024"
5
5
  description = "Python bindings for ferogram (Rust MTProto)"
6
6
  license = "MIT OR Apache-2.0"
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
12
12
 
13
13
  [dependencies]
14
14
  hex = "0.4"
15
- ferogram = "0.3.8"
15
+ ferogram = "0.4.0"
16
16
  pyo3 = { version = "0.24", features = ["extension-module", "abi3-py313"] }
17
17
  pyo3-async-runtimes = { version = "0.24", features = ["tokio-runtime"] }
18
18
  tokio = { version = "1", features = ["full"] }
@@ -4,7 +4,6 @@ Python bindings for the ferogram MTProto client.
4
4
 
5
5
  All client methods are async. The `peer` parameter accepts "@username", "me", or a numeric ID (int or string).
6
6
 
7
- ---
8
7
 
9
8
  ## Imports
10
9
 
@@ -36,7 +35,6 @@ from ferogram.raw.generated.functions.messages import SendMessage
36
35
  from ferogram.raw.generated.types.messages import Messages
37
36
  ```
38
37
 
39
- ---
40
38
 
41
39
  ## Client Setup
42
40
 
@@ -61,7 +59,6 @@ async with app as client:
61
59
 
62
60
  Credentials can also come from env vars: `API_ID`, `API_HASH`, `BOT_TOKEN`.
63
61
 
64
- ---
65
62
 
66
63
  ## Event Handlers
67
64
 
@@ -84,12 +81,12 @@ Decorators to register handlers. Each accepts zero or more filters.
84
81
  @app.on_shipping_query(*filters)
85
82
  @app.on_pre_checkout_query(*filters)
86
83
  @app.on_chat_boost(*filters)
84
+ @app.on_guest_chat_query(*filters)
87
85
  @app.on_raw_update(*filters)
88
86
  ```
89
87
 
90
88
  Handler signature: `async def handler(client, update):`
91
89
 
92
- ---
93
90
 
94
91
  ## Filters
95
92
 
@@ -184,13 +181,23 @@ filters.or_(f1, f2)
184
181
  filters.not_(f1)
185
182
  ```
186
183
 
187
- ---
188
184
 
189
185
  ## Messaging
190
186
 
191
187
  ```python
192
188
  await client.send_message(peer, text, parse_mode=None)
193
189
  # parse_mode: None (plain) | "html" | "markdown"
190
+ # Note: "markdown" uses MarkdownV2 format since ferogram 0.3.9.
191
+ # __text__ = Underline (was Italic in V1)
192
+ # ~text~ = Strike (was ~~text~~ in V1)
193
+ # > text = Blockquote (new)
194
+ # **> text = Expandable blockquote (new)
195
+ # HTML parse_mode supports these tags:
196
+ # <b>, <strong>, <i>, <em>, <u>, <ins>, <s>, <del>, <strike>
197
+ # <tg-spoiler>, <span class="tg-spoiler">
198
+ # <blockquote>, <blockquote expandable>
199
+ # <tg-time unix="N" format="F">, <tg-emoji emoji-id="N">
200
+ # <code>, <pre>, <pre><code class="language-X">
194
201
 
195
202
  await client.send_to_self(text)
196
203
  await client.edit_message(peer, message_id, new_text)
@@ -210,6 +217,7 @@ await client.send_reaction(peer, message_id, emoji)
210
217
  await client.read_reactions(peer)
211
218
  await client.clear_recent_reactions()
212
219
  await client.get_reaction_list(peer, msg_id, limit=100) # -> [(peer_id, emoji)]
220
+ await client.delete_reaction(peer, msg_id, participant) # report/remove a user's reaction
213
221
  await client.mark_as_read(peer)
214
222
  await client.clear_mentions(peer)
215
223
  await client.send_chat_action(peer, "typing") # or ChatAction.TYPING
@@ -236,7 +244,6 @@ await message.react(emoji)
236
244
  `reply_to_message_id`, `via_bot_id`, `grouped_id`, `has_media`, `has_photo`, `has_document`,
237
245
  `is_forwarded`, `post_author`, `view_count`, `reply_count`
238
246
 
239
- ---
240
247
 
241
248
  ## Media
242
249
 
@@ -254,7 +261,6 @@ await client.edit_chat_photo(peer, path)
254
261
  await client.delete_profile_photos()
255
262
  ```
256
263
 
257
- ---
258
264
 
259
265
  ## Polls
260
266
 
@@ -262,12 +268,19 @@ await client.delete_profile_photos()
262
268
  await client.send_poll(
263
269
  peer, question, answers=["A", "B", "C"],
264
270
  quiz=False, correct_index=None, multiple_choice=False,
271
+ public_voters=False, shuffle_answers=False,
272
+ hide_results_until_close=False,
273
+ close_period=None, # auto-close after N seconds (1-600)
274
+ close_date=None, # auto-close at unix timestamp
275
+ solution=None, # explanation shown after quiz answer
265
276
  )
266
277
  await client.send_vote(peer, msg_id, options=[b"\x00"])
267
278
  await client.get_poll_votes(peer, msg_id, limit=100) # -> [(user_id, option_bytes)]
279
+ await client.get_poll_results(peer, msg_id, poll_hash)
280
+ await client.get_poll_stats(peer, msg_id) # -> views count (int)
281
+ await client.delete_reaction(peer, msg_id, participant) # report/remove a user's reaction
268
282
  ```
269
283
 
270
- ---
271
284
 
272
285
  ## Inline Bots
273
286
 
@@ -286,7 +299,6 @@ from ferogram import InlineMessageId
286
299
  await client.edit_inline_message(InlineMessageId(dc_id=2, id_bytes=b"..."), "new text")
287
300
  ```
288
301
 
289
- ---
290
302
 
291
303
  ## Chats & Groups
292
304
 
@@ -324,7 +336,6 @@ await client.mark_dialog_read(peer)
324
336
 
325
337
  `user_id`, `first_name`, `last_name`, `username`, `bot`, `status`, `admin_rank`, `full_name`
326
338
 
327
- ---
328
339
 
329
340
  ## Forum Topics
330
341
 
@@ -335,7 +346,6 @@ await client.edit_forum_topic(peer, topic_id, title=None, closed=None, hidden=No
335
346
  await client.delete_forum_topic_history(peer, top_msg_id)
336
347
  ```
337
348
 
338
- ---
339
349
 
340
350
  ## Join Requests
341
351
 
@@ -344,7 +354,6 @@ await client.join_request(peer, user_id, approve=True)
344
354
  await client.all_join_requests(peer, approve=True, link=None)
345
355
  ```
346
356
 
347
- ---
348
357
 
349
358
  ## Account & Profile
350
359
 
@@ -364,7 +373,6 @@ await client.export_session_string() # -> str
364
373
 
365
374
  `id`, `first_name`, `last_name`, `username`, `phone`, `bot`, `full_name`, `mention`
366
375
 
367
- ---
368
376
 
369
377
  ## Contacts & Blocking
370
378
 
@@ -378,7 +386,6 @@ await client.unblock_user(peer)
378
386
  await client.get_blocked_users(limit=100) # -> [int]
379
387
  ```
380
388
 
381
- ---
382
389
 
383
390
  ## Search
384
391
 
@@ -387,7 +394,6 @@ await client.search_messages(peer, query, limit=100)
387
394
  await client.search_global(query, limit=100)
388
395
  ```
389
396
 
390
- ---
391
397
 
392
398
  ## Drafts
393
399
 
@@ -397,7 +403,6 @@ await client.clear_all_drafts()
397
403
  await client.sync_drafts()
398
404
  ```
399
405
 
400
- ---
401
406
 
402
407
  ## Notifications
403
408
 
@@ -408,7 +413,6 @@ await client.get_notify_settings(peer)
408
413
  await client.update_notify_settings(peer, mute_until=None, silent=None, show_previews=None)
409
414
  ```
410
415
 
411
- ---
412
416
 
413
417
  ## Privacy
414
418
 
@@ -424,7 +428,6 @@ await client.set_privacy(PrivacyKey.PHONE_NUMBER, PrivacyRule.ALLOW_CONTACTS)
424
428
 
425
429
  **PrivacyRule:** `ALLOW_ALL`, `ALLOW_CONTACTS`, `DISALLOW_ALL`, `DISALLOW_CONTACTS`
426
430
 
427
- ---
428
431
 
429
432
  ## Sessions & Auth
430
433
 
@@ -437,7 +440,6 @@ token, expires = await client.export_login_token()
437
440
  username = await client.check_qr_login(token) # None if still pending
438
441
  ```
439
442
 
440
- ---
441
443
 
442
444
  ## Bot Management
443
445
 
@@ -449,7 +451,6 @@ await client.get_bot_info(lang_code="")
449
451
  await client.open_mini_app(peer, app_type="main", app_value="") # -> MiniAppSession
450
452
  ```
451
453
 
452
- ---
453
454
 
454
455
  ## Stats
455
456
 
@@ -457,9 +458,9 @@ await client.open_mini_app(peer, app_type="main", app_value="") # -> MiniAppSe
457
458
  await client.get_broadcast_stats(peer)
458
459
  await client.get_megagroup_stats(peer)
459
460
  await client.get_game_high_scores(peer, msg_id, user_id) # -> [(position, user_id, score)]
461
+ await client.get_poll_stats(peer, msg_id) # -> views count (int)
460
462
  ```
461
463
 
462
- ---
463
464
 
464
465
  ## Payments
465
466
 
@@ -473,7 +474,6 @@ await client.send_invoice(
473
474
  )
474
475
  ```
475
476
 
476
- ---
477
477
 
478
478
  ## Peer Resolution
479
479
 
@@ -483,7 +483,6 @@ await client.resolve_username(username) # -> int
483
483
  await client.warm_peer_cache_from_dialogs()
484
484
  ```
485
485
 
486
- ---
487
486
 
488
487
  ## Raw API
489
488
 
@@ -498,7 +497,6 @@ All four styles produce identical TL requests. The difference is only ergonomics
498
497
  | `from ferogram.raw.api import functions` | Compatibility only. Do not use for new code. |
499
498
  | Direct `generated` import | Advanced use: tooling, debugging, type checking. |
500
499
 
501
- ---
502
500
 
503
501
  ### 1. Namespace proxy (recommended)
504
502
 
@@ -524,7 +522,6 @@ result = await client.raw.channels.GetFullChannel(
524
522
  )
525
523
  ```
526
524
 
527
- ---
528
525
 
529
526
  ### 2. `functions` import (recommended for explicit control)
530
527
 
@@ -561,7 +558,6 @@ result = await client.invoke(
561
558
  result = await client(functions.users.GetFullUser(id=await client.resolve_peer("@user")))
562
559
  ```
563
560
 
564
- ---
565
561
 
566
562
  ### 3. `api` import (compatibility only)
567
563
 
@@ -579,7 +575,6 @@ result = await client.invoke(
579
575
  )
580
576
  ```
581
577
 
582
- ---
583
578
 
584
579
  ### 4. Direct class import (advanced)
585
580
 
@@ -605,7 +600,6 @@ result = await client.invoke(
605
600
 
606
601
  The `generated/` directory is internal codegen output. Direct imports from it are considered advanced usage and may change between versions.
607
602
 
608
- ---
609
603
 
610
604
  ## Logging
611
605
 
@@ -616,7 +610,18 @@ fero_log.setup() # INFO to stderr
616
610
  fero_log.setup(level=10) # DEBUG
617
611
  ```
618
612
 
619
- ---
613
+
614
+ ## GuestChatQuery
615
+
616
+ Fired when a bot receives a guest-chat inline query (`updateBotGuestChatQuery`). Bots only.
617
+
618
+ ```python
619
+ @app.on_guest_chat_query()
620
+ async def handler(client, query):
621
+ # query.query_id int
622
+ # query.qts int
623
+ pass
624
+ ```
620
625
 
621
626
  ## ChatAction
622
627
 
@@ -635,8 +640,4 @@ ChatAction.RECORD_ROUND
635
640
  ChatAction.UPLOAD_ROUND
636
641
  ChatAction.CANCEL
637
642
  ```
638
- ---
639
-
640
- Thanks for reading.
641
643
 
642
- Have a great experience with ferogram.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ferogram
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -35,5 +35,6 @@
35
35
  from . import tl
36
36
  _tl = tl
37
37
  from .generated import functions, types
38
+ from .generated._tl_schema import LAYER
38
39
 
39
- __all__ = ["functions", "types", "tl", "_tl"]
40
+ __all__ = ["functions", "types", "tl", "_tl", "LAYER"]
@@ -90,6 +90,14 @@ def parse_tl(path: Path) -> tuple[list[Constructor], list[Constructor]]:
90
90
  return types, funcs
91
91
 
92
92
 
93
+ def parse_layer(path: Path) -> int:
94
+ for line in path.read_text().splitlines():
95
+ m = re.match(r"^//\s*LAYER\s+(\d+)", line.strip())
96
+ if m:
97
+ return int(m.group(1))
98
+ return 0
99
+
100
+
93
101
  import keyword as _keyword
94
102
 
95
103
  def py_class(tl_name: str) -> str:
@@ -199,10 +207,22 @@ def build_schema_by_cid(constructors: list[Constructor]) -> str:
199
207
  LICENSE = """\
200
208
  # Copyright (c) Ankit Chaubey <ankitchaubey.dev@gmail.com>
201
209
  # SPDX-License-Identifier: MIT OR Apache-2.0
210
+ #
211
+ # ferogram is a high-performance Telegram MTProto framework written in Rust.
212
+ # ferogram-py provides Python bindings built on top of the Rust core for
213
+ # building Telegram clients, bots, and applications with a simple API.
214
+ #
215
+ # Rust core: https://github.com/ankit-chaubey/ferogram
216
+ # Python bindings: https://github.com/ankit-chaubey/ferogram-py
217
+ #
218
+ # If you use or modify this code, keep this notice at the top of the file
219
+ # and include the LICENSE-MIT or LICENSE-APACHE file from this repository.
202
220
  """
203
221
 
204
222
  NS_HEADER = """\
205
223
  # auto-generated by ferogram raw codegen - do not edit
224
+
225
+ """ + LICENSE + """
206
226
  from __future__ import annotations
207
227
  from typing import Any
208
228
  from ... import tl as _tl
@@ -230,8 +250,9 @@ def write_namespace_pkg(
230
250
 
231
251
  # flat imports - re-exports every class from every namespace module
232
252
  init_lines = [
253
+ "# auto-generated - do not edit\n",
254
+ "",
233
255
  LICENSE,
234
- "# auto-generated - do not edit",
235
256
  "# Flat imports so both styles work:",
236
257
  "# raw.functions.messages.GetHistory(...) ← namespace style",
237
258
  "# raw.functions.GetHistory(...) ← flat style (convenience)",
@@ -252,6 +273,7 @@ def write_namespace_pkg(
252
273
 
253
274
  def generate(tl_path: Path, out_dir: Path) -> None:
254
275
  types, funcs = parse_tl(tl_path)
276
+ layer = parse_layer(tl_path)
255
277
  out_dir.mkdir(parents=True, exist_ok=True)
256
278
 
257
279
  all_constructors = types + funcs
@@ -260,7 +282,9 @@ def generate(tl_path: Path, out_dir: Path) -> None:
260
282
 
261
283
  # _tl_schema.py - unchanged format, used by serializer
262
284
  (out_dir / "_tl_schema.py").write_text(
263
- "# auto-generated schema - do not edit\n"
285
+ "# auto-generated schema - do not edit\n\n"
286
+ + LICENSE + "\n"
287
+ + (f"LAYER = {layer}\n\n" if layer else "")
264
288
  + schema_str + "\n\n"
265
289
  + schema_by_cid + "\n"
266
290
  )
@@ -279,7 +303,8 @@ def generate(tl_path: Path, out_dir: Path) -> None:
279
303
 
280
304
  # generated/__init__.py
281
305
  (out_dir / "__init__.py").write_text(
282
- LICENSE + "\n"
306
+ "# auto-generated - do not edit\n\n"
307
+ + LICENSE + "\n"
283
308
  "from . import functions, types\n\n"
284
309
  "__all__ = ['functions', 'types']\n"
285
310
  )
@@ -1,3 +1,5 @@
1
+ # auto-generated - do not edit
2
+
1
3
  # Copyright (c) Ankit Chaubey <ankitchaubey.dev@gmail.com>
2
4
  # SPDX-License-Identifier: MIT OR Apache-2.0
3
5
  #
@@ -11,7 +13,6 @@
11
13
  # If you use or modify this code, keep this notice at the top of the file
12
14
  # and include the LICENSE-MIT or LICENSE-APACHE file from this repository.
13
15
 
14
-
15
16
  from . import functions, types
16
17
 
17
18
  __all__ = ['functions', 'types']