Problems caused by untitled Pixiv works
ovrase opened this issue · 2 comments
Describe the bug
When sending it an untitled Pixiv work, it will report an error: Error: 'NoneType' object has no attribute 'reply'
To Reproduce
Steps to reproduce the behavior:
Send https://www.pixiv.net/artworks/84247460
Error output / Logs
2021-06-14T12:57:21.920904+00:00 app[web.1]: 2021-06-14 12:57:21,916 - nazurin - INFO - Collection update: site=Pixiv, match=('84247460',)
2021-06-14T12:57:21.952182+00:00 app[web.1]: 2021-06-14 12:57:21,950 - aiohttp.access - **delete**
2021-06-14T12:57:22.714919+00:00 app[web.1]: 2021-06-14 12:57:22,714 - nazurin - INFO - Bookmarked artwork 84247460
2021-06-14T12:57:27.817956+00:00 app[web.1]: 2021-06-14 12:57:27,817 - nazurin - ERROR - BadRequest exception: Group send failed
2021-06-14T12:57:27.818677+00:00 app[web.1]: 2021-06-14 12:57:27,818 - nazurin - ERROR - Update **delete**
2021-06-14T12:57:27.819201+00:00 app[web.1]: Traceback (most recent call last):
2021-06-14T12:57:27.819287+00:00 app[web.1]: File "/app/nazurin/bot.py", line 77, in sendIllust
2021-06-14T12:57:27.819288+00:00 app[web.1]: await self.sendPhotos(illust, chat_id, reply_to)
2021-06-14T12:57:27.819292+00:00 app[web.1]: File "/app/nazurin/bot.py", line 60, in sendPhotos
2021-06-14T12:57:27.819296+00:00 app[web.1]: await self.sendSingleGroup(group, caption, chat_id, reply_to)
2021-06-14T12:57:27.819321+00:00 app[web.1]: File "/app/nazurin/utils/decorators.py", line 51, in decorator
2021-06-14T12:57:27.819322+00:00 app[web.1]: result = await func(*args, **kwargs)
2021-06-14T12:57:27.819326+00:00 app[web.1]: File "/app/nazurin/bot.py", line 41, in sendSingleGroup
2021-06-14T12:57:27.819326+00:00 app[web.1]: await self.send_media_group(chat_id,
2021-06-14T12:57:27.819412+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/aiogram/bot/bot.py", line 1017, in send_media_group
2021-06-14T12:57:27.819413+00:00 app[web.1]: result = await self.request(api.Methods.SEND_MEDIA_GROUP, payload, files)
2021-06-14T12:57:27.819413+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/aiogram/bot/base.py", line 208, in request
2021-06-14T12:57:27.819414+00:00 app[web.1]: return await api.make_request(self.session, self.server, self.__token, method, data, files,
2021-06-14T12:57:27.819414+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/aiogram/bot/api.py", line 140, in make_request
2021-06-14T12:57:27.819414+00:00 app[web.1]: return check_result(method, response.content_type, response.status, await response.text())
2021-06-14T12:57:27.819415+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/aiogram/bot/api.py", line 115, in check_result
2021-06-14T12:57:27.819415+00:00 app[web.1]: exceptions.BadRequest.detect(description)
2021-06-14T12:57:27.819416+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/aiogram/utils/exceptions.py", line 141, in detect
2021-06-14T12:57:27.819416+00:00 app[web.1]: raise cls(description)
2021-06-14T12:57:27.819421+00:00 app[web.1]: aiogram.utils.exceptions.BadRequest: Group send failed
2021-06-14T12:57:27.819453+00:00 app[web.1]:
2021-06-14T12:57:27.819454+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2021-06-14T12:57:27.819455+00:00 app[web.1]:
2021-06-14T12:57:27.819458+00:00 app[web.1]: Traceback (most recent call last):
2021-06-14T12:57:27.819532+00:00 app[web.1]: File "/app/nazurin/__main__.py", line 53, in on_error
2021-06-14T12:57:27.819533+00:00 app[web.1]: raise exception
2021-06-14T12:57:27.819539+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py", line 1340, in process_response
2021-06-14T12:57:27.819539+00:00 app[web.1]: response = task.result()
2021-06-14T12:57:27.819562+00:00 app[web.1]: File "/app/nazurin/dispatcher.py", line 52, in update_collection
2021-06-14T12:57:27.819563+00:00 app[web.1]: await self.bot.updateCollection(urls, message)
2021-06-14T12:57:27.819566+00:00 app[web.1]: File "/app/nazurin/bot.py", line 122, in updateCollection
2021-06-14T12:57:27.819567+00:00 app[web.1]: await asyncio.gather(save, download)
2021-06-14T12:57:27.819594+00:00 app[web.1]: File "/app/nazurin/bot.py", line 79, in sendIllust
2021-06-14T12:57:27.819595+00:00 app[web.1]: await handleBadRequest(message, error)
2021-06-14T12:57:27.819598+00:00 app[web.1]: File "/app/nazurin/utils/helpers.py", line 25, in handleBadRequest
2021-06-14T12:57:27.819599+00:00 app[web.1]: await message.reply(
2021-06-14T12:57:27.819646+00:00 app[web.1]: AttributeError: 'NoneType' object has no attribute 'reply'
Environment (please complete the following information):
- Heroku
Thanks for reporting.
This issue has nothing to do with the title of illustration, it's because the sum of width and height of the third image in this artwork exceeds Telegram's limit - 10000 (7488 + 3365).
The bot could handle this situation properly when there's only a single image, but unfortunately Pixiv API does not provide enough information for multiple ones.
We'll look into possible solutions soon, sorry for the inconvenience.
Fixed.