feat: add date_time MessageEntity#58
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for Telegram’s date_time MessageEntity across the formatting/tag API and entity utilities, aligned with a grammy version bump that exposes the new entity type.
Changes:
- Upgrade
grammydependency and Deno type import to a version that includesdate_time. - Add
date_timesupport to entity-tag creation (time),FormattedStringcomposition, and entity similarity/consolidation/sorting utilities. - Introduce focused tests for
date_timeformatting and util behaviors (similarity/equality/consolidation).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/entity-tag.ts |
Refactors buildFormatter and adds time() tag generator for date_time. |
src/format.ts |
Adds FormattedString.time static + instance helpers built on the new entity tag. |
src/util.ts |
Extends entity similarity, consolidation keying, and deterministic sorting to account for date_time metadata. |
test/format.time.test.ts |
Verifies FormattedString.time creates correct date_time entities (with/without format). |
test/util.date_time.test.ts |
Verifies util equality/similarity and consolidation behavior for date_time. |
src/deps.deno.ts |
Updates Deno type import for grammy. |
package.json |
Bumps grammy in dev + peer dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for Telegram's
date_timemessage entity, allowing formatted strings to include date and time metadata. The changes upgrade thegrammydependency, update types, add new utility and formatting methods fordate_time, and introduce comprehensive tests to ensure correct functionality and consolidation behavior.Date_time entity support:
timefunction insrc/entity-tag.tsto createdate_timeentity tags, and updated thebuildFormatterfunction to support this entity type.timemethods in theFormattedStringclass to allow easy creation and combination of date_time formatted strings. [1] [2]date_timehandling to utility functions for entity comparison, consolidation, and sorting insrc/util.ts. [1] [2] [3]Dependency and type updates:
grammydependency inpackage.jsonand updated the Deno types import to match the new version. [1] [2]Testing:
date_timeentity formatting and utility functions, covering creation, comparison, and consolidation. [1] [2]