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()