def addEntry(update, context): if(not isBotAuthorized(update.effective_chat.id)): context.bot.send_message(chat_id=update.effective_chat.id, text=bot_messages['UNAUTHORIZED_MESSAGE'].format(update.effective_chat.id)) else: updateJournal(update.message.text) context.bot.send_message(chat_id=update.effective_chat.id, text=bot_messages['JOURNALENTRY_MESSAGE'].format(update.message.text))
def image_handler(update, context): if(not isBotAuthorized(update.effective_chat.id)): context.bot.send_message(chat_id=update.effective_chat.id, text=bot_messages['UNAUTHORIZED_MESSAGE'].format(update.effective_chat.id)) else: # print ( context.bot.getFile(update.message.photo[-1])) file = context.bot.getFile(update.message.photo[-1].file_id) f = BytesIO(file.download_as_bytearray()) path = updateAsset(f.getvalue(),"jpg") updateJournal(path, ignoreURL=True) context.bot.send_message(chat_id=update.effective_chat.id, text=bot_messages['IMAGEUPLOAD_MESSAGE'].format(BotName,getBotVersion()))
def hypothesis(update, context): if (not isBotAuthorized(update.effective_chat.id)): context.bot.send_message( chat_id=update.effective_chat.id, text=bot_messages['UNAUTHORIZED_MESSAGE'].format( update.effective_chat.id)) else: if (isManageHypothesis()): path = getAnnotationPath(context.args[0]) #print(path) pageAlias = getWebPageTitle(context.args[0]) updateJournal(getHypothesisAnnotations(context.args[0]), False, path, True, pageAlias) if (isHypothesisEmbedded()): updateJournal(entry='{{embed [[' + getPageTitle(path) + ']]}}') else: updateJournal(entry="Annotations of [" + pageAlias + "](" + getPageTitle(path) + ")") else: updateJournal(getHypothesisAnnotations(context.args[0]), False) context.bot.send_message( chat_id=update.effective_chat.id, text=bot_messages['HYPOTHESIS_MESSAGE'].format(context.args[0]))