Add base structure for bot.py
This commit is contained in:
parent
5ce758ca97
commit
e897d6c162
|
@ -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()
|
Loading…
Reference in New Issue