Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Send Message Bot

This script allows a bot to send a message to a Telegram channel without storing the IDs of all users.
This Python script utilizes the aiogram and apscheduler libraries to send scheduled messages to a Telegram channel based on the day of the week. It can be used to send daily reminders or periodic messages to a specific Telegram channel.

Index

Prerequisites

Before running the script, make sure to install the following dependencies:

pip install aiogram==3.17 apscheduler pytz

Configuration

  1. Telegram Bot Token: Replace ID Bot Telegram with the token of your Telegram bot. You can obtain a token by registering a new bot on BotFather .
    bot = Bot(token='ID Bot Telegram')
  1. Telegram Channel ID: Replace @ID Canale with the ID of your Telegram channel, where you want to send the messages.
    channel_id = "@Channel ID"
  1. Daily Messages: Modify the messages dictionary to customize the messages that will be sent each day of the week.
    messages = {
    "Monday": "Today is Monday",
    "Tuesday": "Today is Tuesday",
    "Wednesday": "Today is Wednesday",
    "Thursday": "Today is Thursday",
    "Friday": "Today is Friday",
    "Saturday": "Today is Saturday",
    "Sunday": "Today is Sunday",
}
  1. Sending Time: Configure the time when you want to send the messages by modifying the scheduler.add_job function. In the example, messages are sent every day at 19:00 (UTC).
    scheduler.add_job(lambda: asyncio.run(send_scheduled_message()), 'cron', day_of_week='mon-sun', hour=19, minute=0)

Running Script

Run the Python script, and the bot will automatically start sending scheduled messages to your Telegram channel.

    python bot.py

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages