Channel-Poll-Bot/bot.py

26 lines
626 B
Python

#!/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()