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))
评论列表
文章目录