Add /list

This commit is contained in:
2019-01-29 02:05:39 +05:30
parent c4afd9139e
commit 0238610cd1
2 changed files with 20 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ import logging
import requests
import re
from emoji import demojize
from telegram.ext import Updater, MessageHandler, Filters
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - \
%(message)s', level=logging.INFO)
@@ -87,7 +87,15 @@ def message_handling(bot, update):
data=params)
def list_cmd(bot, update):
if update.message.chat.id in config.groups:
params = {"message": "list"}
requests.post("http://localhost:" + str(config.port) + "/post",
data=params)
updater = Updater(token=config.api_key)
dispatcher = updater.dispatcher
dispatcher.add_handler(CommandHandler('list', list_cmd))
dispatcher.add_handler(MessageHandler(Filters.all, message_handling))
updater.start_polling()