From e897d6c162651d28919c76035579e4b005793173 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Tue, 1 Jan 2019 21:49:23 +0530 Subject: [PATCH] Add base structure for bot.py --- bot.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bot.py diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..27c4c1b --- /dev/null +++ b/bot.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# coding=utf-8 + +import config +import sqlite3 +from telegram.ext import Updater, MessageHandler, Filters + + +def main(bot, update, db): + chat_id = update.message.chat_id + if chat_id in config.allowed_users: + pass + else: + bot.send_message(chat_id=chat_id, text="Not Authorized") + + +updater = Updater(token=config.api_key) +dispatcher = updater.dispatcher + +db = sqlite3.connect("chanbot.sqlite", check_same_thread=False) +cursor = db.cursor() + +dispatcher.add_handler(MessageHandler(Filters.photo, lambda x, y: main(x, + y, db))) +updater.start_polling()