Skip to content

Weekly Form Message - #1

Merged
Arrat3 merged 1 commit into
mainfrom
cron
Jul 7, 2026
Merged

Arrat3 merged 1 commit into
mainfrom
cron

Conversation

@Arrat3

@Arrat3 Arrat3 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 7, 2026 19:15
@Arrat3
Arrat3 merged commit 403bc17 into main Jul 7, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a scheduled “weekly form reminder” feature for the Telegram bot by persisting registered groups locally and sending a recurring broadcast message via a cron task.

Changes:

  • Add a cron-based task to broadcast a weekly reminder message to all active groups.
  • Add a group registry (stored in groups.json) with activation/disable logic when the bot is removed or lacks permissions.
  • Update environment example and ignore local state (groups.json) in git.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/tasks/weekly-message.js Adds the scheduled broadcast logic and auto-disables groups on Telegram permission errors.
src/indx.js Adds bot initialization, /addgroup registration command, and hooks the weekly scheduler.
src/groups-store.js Implements local persistence for group registration and active-state management.
.gitignore Ignores groups.json and normalizes .env ignore entry.
.env.example Documents TIMEZONE used by the scheduler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +7
const timezone = process.env.TIMEZONE || "Asia/Damascus";

cron.schedule("* * * * *", async () => {
Comment thread src/indx.js
Comment on lines +1 to +4
require ('dotenv').config();
const { Telegraf } = require('telegraf');
const { upsertGroup, setGroupActive, getActiveGroups } = require('./groups-store');
const { sundayMessage } = require('./tasks/weekly-message');
Comment thread src/groups-store.js
const fs = require("fs");
const path = require("path");

const groupsFilePath = path.join(process.cwd(), "groups.json");
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.

2 participants