Telegram bot for looking for news. Has scheduling and preferences
TRY IT RIGHT HERE: @GooglNews_bot
Don't forget to rate: Rate this bot
- First, you have to create a table in MySQL like this:
CREATE TABLE NewsBot ( -> usr_name VARCHAR(150), -> chat_id INT(15) NOT NULL PRIMARY KEY, -> lang CHAR(2), -> diff_time VARCHAR(50), -> preferences VARCHAR(10000), -> programation VARCHAR(150), -> next_prog VARCHAR(150), -> msg_id INT(20), -> max_results INT(3), -> is_time VARCHAR(5), -> is_prog VARCHAR(5), -> is_pref VARCHAR(5), -> last_time VARCHAR(50) );
- Then, ask BotFather for a TOKEN unique for your bot.
- Save that token into a file called TOKEN.txt.
- Go to this Google page and ask for your API-KEY. Save it in API-KEY_geo.txt (don't forget to activate your API).
- Go to this another Google page and ask for your API-KEY. Save it in API-KEY.txt (don't forget to activate your API).
It's done, you have finished your initial set-up
Install this packages with
pip (using Python 3):
pip install PyMySQL
pip install python-telegram-bot
pip install py-GSearch-API
pip install bs4
pip install ujson
pip install unidecode
pip install URLEncoder
pip install requests
pip install html
pip install contextlib
When finished, everything is now set-up.
python bot.py and the bot will start
The next message has to be included in every copy of this program, modified or not
NewsBot (Telegram) -- A simple bot for getting news from Google Copyright (C) 2017 Javinator9889 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. For contacting, go to "https://github.com/Javinator9889/NewsBot/issues" and type your message. Also you can go to my GitHub profile and send me direct message.