Add base structure for bot.py

This commit is contained in:
Ceda EI 2019-01-01 21:49:23 +05:30
parent 5ce758ca97
commit e897d6c162
1 changed files with 25 additions and 0 deletions

25
bot.py Normal file
View File

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