raiwalletbot.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:RaiWalletBot 作者: SergiySW 项目源码 文件源码
def photo_filter_callback(bot, update):
    user_id = update.message.from_user.id
    lang_id = mysql_select_language(user_id)
    try:
        image = update.message.photo[-1]
        path = '{1}download/{0}.jpg'.format(image.file_id, qr_folder_path)
        #print(image)
        newFile = bot.getFile(image.file_id)
        newFile.download(path)
        qr = account_by_qr(path)
        account = qr[0]
        print(account)
        if ('xrb_' in account):
            lang_keyboard(lang_id, bot, update.message.chat_id, lang_text('qr_send', lang_id).format(account))
            sleep(1)
            if (len(qr) > 1):
                send_destination(bot, update, account, True)
                sleep(0.3)
                print(qr[1])
                send_amount(bot, update, qr[1], True)
            else:
                send_destination(bot, update, account)
        elif (('NULL' in account) or (account is None) or (account is False)):
            lang_keyboard(lang_id, bot, update.message.chat_id, lang_text('qr_recognize_error', lang_id))
        else:
            lang_keyboard(lang_id, bot, update.message.chat_id, lang_text('qr_account_error', lang_id))
        #print(account)
        logging.info('QR by file: {0}'.format(account))
    except UnicodeEncodeError:
        lang_keyboard(lang_id, bot, update.message.chat_id, lang_text('text_decode_error', lang_id))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号