コード例 #1
0
def version(update, context):
    if (not isBotAuthorized(update.effective_chat.id)):
        context.bot.send_message(chat_id=update.effective_chat.id,
                                 text=bot_messages['UNAUTHORIZED_MESSAGE'])
    else:
        context.bot.send_message(chat_id=update.effective_chat.id,
                                 text=bot_messages['VER_MESSAGE'].format(
                                     BotName, getBotVersion()))
コード例 #2
0
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:
        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()))