def filters(bot, update):
chat = update.effective_chat
msg = update.effective_message
args = msg.text.split(None, 2) # use python's maxsplit to separate Cmd, keyword, and reply_text
keyword = args[1]
is_sticker = False
is_document = False
if len(args) >= 3:
content = args[2]
elif msg.reply_to_message and msg.reply_to_message.sticker:
content = msg.reply_to_message.sticker.file_id
is_sticker = True
elif msg.reply_to_message and msg.reply_to_message.document:
content = msg.reply_to_message.document.file_id
is_document = True
else:
return
save_filter(chat.id, keyword, content, is_sticker, is_document)
update.effective_message.reply_text("Handler {} added!".format(keyword))
raise DispatcherHandlerStop
评论列表
文章目录