Ejemplo n.º 1
0
    async def send(prefix_: str, data_: SetuData):
        try:
            setu_b: bytes = await data_.get()
            EventLogger.info("已经下载成功,现在发送到qq群")
            await app.sendGroupMessage(group,
                                       [At(sender.id), Plain("欧尼酱~(^ω^)♪看看这是不是你想要的色图"),Plain(prefix_ + data_.purl + '\n'), Image.fromBytes(setu_b), Plain(f"性癖是:{','.join(data_.tags)}")])
            EventLogger.info(f"{prefix_}色图已发送,标签:{','.join(data_.tags)}")

        except asyncio.TimeoutError as e:
            EventLogger.warn('连接超时' + str(e))
            raise e
        except ValueError as e:
            EventLogger.warn('图片尺寸检查失败' + str(e))
            raise e
Ejemplo n.º 2
0
 async def send(prefix_: str, data_: SetuData):
     try:
         setu_b: bytes = await data_.get(False)
         await app.sendGroupMessage(group, [
             At(sender.id),
             Plain(prefix_ + data_.purl + '\n'),
             Image.fromBytes(setu_b)
         ])
         EventLogger.info(f"{prefix_}色图已发送,标签:{','.join(data_.tags)}")
     except asyncio.TimeoutError as e:
         EventLogger.warn('连接超时' + str(e))
         # raise e
         try:
             await app.sendGroupMessage(group, [
                 At(sender.id),
                 Plain(prefix_ + data_.purl + '\n' + data_.url +
                       '\n自己动手,丰衣足食')
             ])
         except Exception as e:
             raise e
     except ValueError as e:
         EventLogger.warn('图片尺寸检查失败' + str(e))
         raise e