qrcodegen.py 文件源码

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

项目:sketal 作者: vk-brain 项目源码 文件源码
def process_message(self, msg):
        command, text = self.parse_message(msg, full_text=True)

        if not text:
            await msg.answer('??????? ????? ??? ?????? ????? ????????????? QR ???')

        qr = qrcode.QRCode(
            error_correction=qrcode.constants.ERROR_CORRECT_L,
            box_size=10,
            border=4,
        )

        qr.add_data(text)

        try:
            qr.make(fit=True)
        except DataOverflowError:
            return await msg.answer('??????? ??????? ?????????!')

        img = qr.make_image()

        buffer = io.BytesIO()
        img.save(buffer, format='png')
        buffer.seek(0)

        result = await upload_photo(self.api, buffer)

        return await msg.answer(f'??? QR ???, ? ???????: \n "{msg.text}"', attachment=str(result))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号