Repository navigation
fix: pass schedule Date to mtcute so --schedule really schedules - #40
Merged
Merged
Conversation
mtcute's high-level sendText/sendMedia read `schedule` (Date, or a number in milliseconds). tgcli passed `scheduleDate`, which is ignored, so scheduled messages were delivered immediately while still returning a message id. resolveScheduleDate() yields unix seconds, so convert to a Date. The low-level messages.sendMedia request keeps `scheduleDate` (raw TL name). Tests asserted the wrong param name; fixed to `schedule: Date`. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner
Author
|
End-to-end check on a real account (owner on office3 running this branch, release |
dapi
added a commit
that referenced
this pull request
Nov 2, 2026
Fixes --schedule on send text/photo/file: scheduled messages are now really scheduled by Telegram instead of being delivered immediately (#40). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Problem
tgcli send text|photo|file --schedule <iso>returned a message id but delivered the message immediately. Found on 2026-11-02: a message meant for 09:00 next day went out at once (also reproduced with Saved Messages).Cause
mtcute's high-level
sendText/sendMediareadschedule(Date, or a number in milliseconds), notscheduleDate.buildTextSendParams/buildMediaSendParamssetparams.scheduleDate, which mtcute ignores. The raw TLmessages.sendMediarequest legitimately usesscheduleDateand is unchanged.Fix
params.schedule = new Date(scheduleDate * 1000)(resolveScheduleDateyields unix seconds; a bare number would be read as ms and land in 1970).The existing tests asserted the wrong param name (
{ scheduleDate }), which is why this was never caught; they now expect{ schedule: Date }.Verification
npx vitest run tests/send-messages.test.js: 54 passed.🤖 Generated with Claude Code