Skip to content

Latest commit

 

History

History
265 lines (188 loc) · 16 KB

CHANGELOG.md

File metadata and controls

265 lines (188 loc) · 16 KB

Changelog

v0.16.0 (2024-09-26)

Feature

  • Telegram API ID and hash now can be loaded from environment (9c22347)

Fix

  • Parse_tgpy_message no longer returns positive result for TGPy error> messages (818e47d)
  • Sending cancel in comments and topics now works correctly. Fix cancel throwing error when the message is not a TGPy message (1d3ba1a)
  • Ctx.is_manual_output is fixed (2e591f5)

Documentation

  • Describe loading of API secrets from env in guide (eb2a023)

v0.15.1 (2024-05-06)

Fix

  • Config is no longer erased when it fails to save. Also, the config is saved synchronously now (df539a3)
  • Restart now works correctly when tgpy is not in PYTHONPATH (e.g. in a container) (16d3830)
  • The correct data directory is now used when TGPY_DATA is set to a relative path and restart is called (f483d6c)

v0.15.0 (2024-04-28)

Feature

  • Telethon: Layer 179 (010f4ef)
  • Cd to DATA_DIR/workdir on tgpy start (f51dc84)
  • Real time progress feedback (8e85d7a)
  • Stop running message execution on cancel, add stop command to only stop execution without blacklisting the message (547c1c6)
  • Truncate exceptions (#39) (739fbbc)

Documentation

  • Reset page scale back to normal (20ec126)

v0.14.1 (2024-03-09)

Fix

  • Use cryptg-anyos again, because there are no official cp312-aarch64 binaries (50ca341)

v0.14.0 (2024-03-09)

Feature

  • docker: Run specified commands on container creation. This feature can be used for example to persist installed packages between updates (456f503)

Fix

  • Tgpy error when editing MessageService, e.g. when deleting all messages in pm or beating your high score in games (5d6fb5e)

v0.13.2 (2023-12-10)

Fix

  • Update telethon (fix draft constructor), update all dependencies (a2b6064)

v0.13.1 (2023-12-06)

Fix

  • Use official cryptg (prebuilt wheels for Python 3.12), bump telethon (fixes usage of Draft), set minimum python version to 3.10 (9e49739)

v0.13.0 (2023-12-05)

Feature

v0.12.1 (2023-10-28)

Fix

  • Telethon: New layer fix (8145bd3)

v0.12.0 (2023-10-28)

Feature

  • Telethon: Update to layer 166 (a18dc0d)

v0.11.0 (2023-09-29)

Feature

  • Telethon: Fixes for the new layer and many more fixes from upstream (800fcd5)

v0.10.0 (2023-09-25)

Feature

Documentation

  • Revert narrowing container (bb0bff9)
  • Recipes and new homepage (28e8eba)
  • Fix transformer example (8007b25)

v0.9.7 (2023-07-23)

Fix

  • Consistent colors in setup across all terminals (faa625b)

v0.9.6 (2023-06-01)

Fix

v0.9.5 (2023-06-01)

Fix

  • Try to fix session termination issue by setting device_model and system_version to real values from the system (44e1c3d)

v0.9.4 (2023-05-05)

Fix

  • Initial setup can now be interrupted with ctrl+c (e6253c7)
  • Initial setup prompts now work properly (8713dff)

v0.9.3 (2023-02-25)

Fix

  • Deleting message no longer produces an error (ef317d9)

v0.9.2 (2023-02-25)

Fix

v0.9.1 (2023-02-25)

Fix

  • Update from older versions (df11e8b)

v0.9.0 (2023-02-25)

Major update

  • restructured the code
  • cancel, // now remember cancellation permanently
  • reactions fix now remembers message content hashes after a restart. This means no more 'Edit message again to evaluate' messages
  • implemented simple key-value store for storing various data
    • tgpy.api.config.get(key: str, default: JSON = None) -> JSON
    • tgpy.api.config.set(key: str, value: JSON)
    • tgpy.api.config.unset(key: str)
    • tgpy.api.config.save() useful when modifying objects acquired using the .get method in place
  • if the __all__ variable is set in a module, only objects with names in that list are exported (added to variables list)
  • ctx.is_module is True if the code is executed as a module (on startup)
  • ctx.is_manual_output can be set to True to prevent the last message edit by TGPy so that you can edit it yourself
  • cancel, //, restart, ping, update, modules object and .await syntax are now implemented as regular modules in the std directory
    • builtin modules can be disabled with core.disable_modules config option (for example, tgpy.api.config.set('core.disable_modules', ['postfix_await']))
  • extra keys are now allowed in module metadata. They are parsed into Module.extra dict
  • tgpy.api module is now used for public API instead of the tgpy object
  • moved get_installed_version, get_running_version, installed_as_package, get_user, get_hostname, running_in_docker, try_await, outgoing_messages_filter functions to tgpy.api (tgpy.api.utils)
  • new public API functions:
    • async parse_code(text: str) -> ParseResult(is_code: bool, original: str, transformed: str, tree: AST | None)
    • parse_tgpy_message(message: Message) -> MessageParseResult(is_tgpy_message: bool, code: str | None, result: str | None)
    • async tgpy_eval(code: str, message: Message = None, *, filename: str = None) -> EvalResult(result: Any, output: str)
  • AST transformers. AST transformers are applied after code transformers
  • exec hooks. Exec hooks are executed before the message is parsed and handled. Exec hooks must have the following signature: async hook(message: Message, is_edit: bool) -> Message | bool | None. An exec hook may edit the message using Telegram API methods and/or alter the message in place. If a hook returns Message object or alters it in place, it's used instead of the original Message object during the rest of handling (including calling other hook functions). If a hook returns True or None, execution completes normally. If a hook returns False, the rest of hooks are executed and then the handling stops without further message parsing or evaluating
    • Apply hooks with tgpy.api.exec_hooks.apply(message: Message, *, is_edit: bool) -> Message | False. This method returns False if any of the hooks returned False, Message object that should be used instead of the original one otherwise
  • new dict/list compatible transformers/hooks interface (store_obj is one of tgpy.api.code_transformers, tgpy.api.ast_transformers or tgpy.api.exec_hooks)
    • add a function with store_obj.add(name, function)
    • add/replace a function with store_obj[name] = function
    • get a function with store_obj[name or index]
    • iter functions with for name, function in store_obj
    • apply transformers/hooks with tgpy.api.code_transformers.apply(code: str) -> str, tgpy.api.ast_transformers.apply(tree: AST) -> AST or tgpy.api.exec_hooks.apply (documented above)
  • podman is now correctly detected so that tgpy doesn't try to update itself in the container
  • Change in-message url to tgpy.tmat.me (8737ca9)
  • Move tokenize_string and untokenize_to_string to tgpy.api (7d8c3b2)

v0.8.0 (2023-02-15)

Feature

  • Wrap sys.stdout instead of print to capture output + properly use contextvars (7aa2015)

Fix

  • Don't stop on unhandled errors. They may happen when, for example, a module uses asyncio.create_task (3584f22)

v0.7.0 (2023-02-05)

Feature

  • Update telethon (new markdown parser, html parser fixes) (43dd76f)
  • Update dependencies (layer 152) (234dc86)

Fix

  • Handle entities properly when editing "//" message (6d989dc)
  • Specify parse_mode in error handler to support markdown global parse mode (60cd81b)
  • Use message.raw_text instead of message.text to detect // (a85b1c8)

v0.6.2 (2023-01-22)

Fix

  • Fix IndentationError appearing for some non-code messages (599c84f)
  • docker: Add /venv/bin to path (00be149)

Documentation

v0.6.1 (2023-01-06)

Fix

  • Update command saying "Already up to date" while in fact updating correctly (9b25fe6)

v0.6.0 (2022-11-26)

Feature

  • Use MessageEntityPre with language set to 'python' to enable syntax highlighting on supported clients (e.g. WebZ). Closes #24 (5de6ded)

Fix

  • Keep 'cancel' message when replying to other user (fixes #21) (057231d)
  • Ignore error when running code deletes the message itself (d022450)

Documentation

v0.5.1 (2022-08-09)

Fix

  • Restart() now edits message properly (60afa44)
  • Compatibility with python 3.9 (f3c0468)

v0.5.0 (2022-08-08)

Feature

  • Use custom telethon fork with updated layer (91894fc) (9c7738e)
  • Transform x.await into await x (6117421) (fde6291)
  • Better version detection, ping() builtin improvements (265b83f)
  • Allow to specify data directory via environment variable TGPY_DATA (4d769da)

Fix

  • Setting/removing reaction no longer triggers reevaluation (#25) (cf6e64e)
  • Emojis no longer break messages markup (#10) (20f48bc)
  • Parsing of modules with triple quotes in code (485166d)

Documentation

  • Guide rewrite

v0.4.1 (2022-01-10)

Fix

  • code detection: Ignore messages like "fix: fix" (1b73815)

v0.4.0 (2022-01-10)

Feature

Fix

  • code detection: Ignore messages like "cat (no)" and "fix: fix" (75bb43e)
  • Data directory path on Windows (7d0e283)
  • Print now always writes to message from which code is executed (0e46527)
  • Ctx.msg now always points to message from which code is executed (59acde9)

Documentation

  • Readme & guide updates (59a4036)
  • Installation with pip & other readme changes (b220b94)

v0.3.0 (2021-12-26)

Feature

  • update: Show when no updates are available (62145ff)

v0.2.3 (2021-12-26)

Fix

  • update: Try both regular installation and --user installation (50ffbe9)

v0.2.2 (2021-12-26)

Fix

  • update: Use --user installation when updating (1902672)

v0.2.1 (2021-12-26)

Fix

  • Update from pypi, if installed as package (a80b78f)
  • Store data in system config dir instead of module directory (7d92544)