lynguyenminh / uit-daily-news-bot

The application automatically retrieves announcements from UIT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AUTO BOT GET NEWS

This bot will announce new post every day from:

This info is being sent to your Telegram account.

My environment:

OS: Ubuntu20.04
Python: 3.8
VPS: 1core-1GB ram (optional)

1. Clone source code and preparing environment

First, git clone this repo and set up environment:

git clone https://github.com/lynguyenminh/uit_daily_news_bot.git && cd uit_daily_news_bot

Then, create virtualenv:

virtualenv venv && source venv/bin/activate
pip install -r requirements.txt

2. Create Telegram bot and add your account

2.1. Create Telegram bot

Search BotFather and do the following, your bot id is the one I blurred: create-bot-tele

2.2. Get your account id

Search userinfobot and type /start

get-user-id

Then fill bot id and account id into send_telegram.py

3. Run code

I schedule it run one time per day at 1.am. To do it, i use crontab.On Ubuntu, open crontab by crontab -e. Then write this script:

0 1 * * * /usr/bin/env bash -c 'cd /root/uit_daily_news_bot && sh /root/uit_daily_news_bot/run.sh'

4. Advance: Add bot to a group

Please check 2 tutorials below: add bot to the group and get the group id.

If this code has any errors, please create issue or contact me by email: 20521592@gm.uit.edu.vn

About

The application automatically retrieves announcements from UIT

License:MIT License


Languages

Language:Python 97.0%Language:Shell 3.0%