Skip to content

feat: add /schedule command for managing scheduled jobs via Telegram#151

Draft
felixeu31 wants to merge 6 commits intoRichardAtCT:mainfrom
felixeu31:features/shedule-command
Draft

feat: add /schedule command for managing scheduled jobs via Telegram#151
felixeu31 wants to merge 6 commits intoRichardAtCT:mainfrom
felixeu31:features/shedule-command

Conversation

@felixeu31
Copy link

@felixeu31 felixeu31 commented Mar 15, 2026

Description Add a user-facing /schedule command that allows managing scheduled jobs directly from Telegram chat, removing the need

for direct SQLite access and bot restarts.

Changes - Inject JobScheduler into bot dependencies (exposed from run_application())

  • Add pause_job() and resume_job() methods to JobScheduler, plus include_paused flag on list_jobs()
  • Add ScheduleCommandHandler with subcommands: - /schedule list — show all jobs (active + paused)
    • /schedule add <name> <min> <hour> <day> <month> <weekday> <prompt> — create a new job
    • /schedule remove <job_id> — soft-delete a job - /schedule pause <job_id> / /schedule resume <job_id> — toggle is_active
  • Register /schedule in both agentic and classic modes, gated on ENABLE_SCHEDULER=true
  • Auto-populate chat_id, working_directory, and created_by from message context
  • Hot-reload: jobs are live immediately via JobScheduler.add_job() — no restart needed - Documentation updated in README, CLAUDE.md, docs/setup.md, and CHANGELOG

Related Issue

Closes #150

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests added/updated (16 new tests, 100% coverage on handler)
  • All tests pass (505 existing + 16 new)
  • Manual testing completed

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated
  • No breaking changes (or clearly documented)

Félix Díez Arias added 6 commits March 15, 2026 10:16
Add "scheduler" key to the bot deps dict and assign the real
JobScheduler instance after creation in run_application(), making
it accessible to command handlers via context.bot_data["scheduler"].
pause_job() removes job from APScheduler and sets is_active=0.
resume_job() re-registers with APScheduler and sets is_active=1.
list_jobs() now accepts include_paused flag to show all jobs.
Single /schedule entry point dispatching to subcommands:
list, add, remove, pause, resume. Auto-populates chat_id,
working_directory, and created_by from Telegram context.
Add /schedule handler to both agentic and classic mode registration,
gated on enable_scheduler. Add to get_bot_commands() for Telegram
command menu visibility.
16 tests covering all subcommands (list, add, remove, pause, resume),
argument parsing edge cases, error handling, and the scheduler-not-
available fallback path. 100% coverage on the handler module.
Update command lists in README and CLAUDE.md, expand the Job Scheduler
section in docs/setup.md with usage examples, and add CHANGELOG entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add /schedule command for managing scheduled jobs via Telegram

1 participant