From 5d135b5037f2fa963790811e8708ec91c513e9c6 Mon Sep 17 00:00:00 2001 From: Huyu2239 Date: Mon, 26 Apr 2021 22:36:07 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[Add]=20=E8=A4=87=E6=95=B0Attachment?= =?UTF-8?q?=E4=BB=98=E3=81=8D=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92=E5=B1=95=E9=96=8B=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispander/module.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dispander/module.py b/dispander/module.py index e945ff4..25d7995 100644 --- a/dispander/module.py +++ b/dispander/module.py @@ -22,8 +22,13 @@ async def on_message(self, message): async def dispand(message): messages = await extract_message(message) for m in messages: + files = [] + if len(m.attachments) >= 2: + m.attachments.pop(0) + for attachment in m.attachments: + files.append(await attachment.to_file()) if m.content: - await message.channel.send(embed=compose_embed(m)) + await message.channel.send(embed=compose_embed(m), files=files) for embed in m.embeds: await message.channel.send(embed=embed) From 174035dd1071145dd275508bcf07b99a5392385f Mon Sep 17 00:00:00 2001 From: Huyu2239 Date: Mon, 26 Apr 2021 22:46:17 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[Fix]=20=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E8=A4=87=E8=A3=BD=E3=81=AF=E8=91=97=E4=BD=9C?= =?UTF-8?q?=E6=A8=A9=E4=B8=8A=E3=81=AE=E5=95=8F=E9=A1=8C=E3=81=8C=E3=81=82?= =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=81=A7=E3=80=81ProxyURL=E3=82=92=E5=88=A9?= =?UTF-8?q?=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispander/module.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dispander/module.py b/dispander/module.py index 25d7995..0bbf930 100644 --- a/dispander/module.py +++ b/dispander/module.py @@ -22,13 +22,16 @@ async def on_message(self, message): async def dispand(message): messages = await extract_message(message) for m in messages: - files = [] + if m.content: + await message.channel.send(embed=compose_embed(m), files=files) if len(m.attachments) >= 2: m.attachments.pop(0) for attachment in m.attachments: - files.append(await attachment.to_file()) - if m.content: - await message.channel.send(embed=compose_embed(m), files=files) + atm_em = Embed() + atm_em.set_image( + url=attachment.proxy_url + ) + await message.channel.send(embed=atm_em) for embed in m.embeds: await message.channel.send(embed=embed) From 6ae0cb0ae0e51a42132079042bc1f19502517a50 Mon Sep 17 00:00:00 2001 From: Huyu2239 Date: Mon, 26 Apr 2021 23:06:55 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[Bugfix]=20=E4=B8=8D=E8=A6=81=E3=81=AA?= =?UTF-8?q?=E5=BC=95=E6=95=B0=E6=8C=87=E5=AE=9A=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispander/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dispander/module.py b/dispander/module.py index 0bbf930..56fca00 100644 --- a/dispander/module.py +++ b/dispander/module.py @@ -23,7 +23,7 @@ async def dispand(message): messages = await extract_message(message) for m in messages: if m.content: - await message.channel.send(embed=compose_embed(m), files=files) + await message.channel.send(embed=compose_embed(m)) if len(m.attachments) >= 2: m.attachments.pop(0) for attachment in m.attachments: From 9f12d937e62b0ce6b885d1a76bf1e5f766f7216b Mon Sep 17 00:00:00 2001 From: Huyu2239 Date: Mon, 26 Apr 2021 23:19:18 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[Refactor]=20=E6=98=8E=E7=A2=BA=E3=81=AA?= =?UTF-8?q?=E5=A4=89=E6=95=B0=E5=90=8D=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispander/module.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dispander/module.py b/dispander/module.py index 56fca00..87b06d8 100644 --- a/dispander/module.py +++ b/dispander/module.py @@ -25,13 +25,14 @@ async def dispand(message): if m.content: await message.channel.send(embed=compose_embed(m)) if len(m.attachments) >= 2: + # Send the second and subsequent attachments with embed (named 'embed') respectively: m.attachments.pop(0) for attachment in m.attachments: - atm_em = Embed() - atm_em.set_image( + embed = Embed() + embed.set_image( url=attachment.proxy_url ) - await message.channel.send(embed=atm_em) + await message.channel.send(embed=embed) for embed in m.embeds: await message.channel.send(embed=embed) From 5f5f593ea362c779abe64381859f98293a8ebb15 Mon Sep 17 00:00:00 2001 From: Huyu2239 Date: Tue, 27 Apr 2021 19:21:10 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[Perf]=20=E3=83=A1=E3=83=A2=E3=83=AA?= =?UTF-8?q?=E5=8A=B9=E7=8E=87=E3=81=AE=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispander/module.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dispander/module.py b/dispander/module.py index 87b06d8..ca96296 100644 --- a/dispander/module.py +++ b/dispander/module.py @@ -26,8 +26,7 @@ async def dispand(message): await message.channel.send(embed=compose_embed(m)) if len(m.attachments) >= 2: # Send the second and subsequent attachments with embed (named 'embed') respectively: - m.attachments.pop(0) - for attachment in m.attachments: + for attachment in m.attachments[1:]: embed = Embed() embed.set_image( url=attachment.proxy_url From a5e69d651f583c9716bc84780cabe0af48a00305 Mon Sep 17 00:00:00 2001 From: 1ntegrale9 <1ntegrale9uation@gmail.com> Date: Thu, 20 May 2021 20:33:27 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[Perf]=20=E3=83=AA=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=AE=E9=95=B7=E3=81=95=E3=81=8C1=E3=81=AE=E5=A0=B4?= =?UTF-8?q?=E5=90=88=E3=81=AF=E3=83=AB=E3=83=BC=E3=83=97=E3=81=8C=E5=9B=9E?= =?UTF-8?q?=E3=82=89=E3=81=9A=E3=81=AB=E7=B5=90=E6=9E=9C=E3=81=8C=E5=90=8C?= =?UTF-8?q?=E3=81=98=E3=81=AA=E3=81=AE=E3=81=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispander/module.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dispander/module.py b/dispander/module.py index ca96296..2f5cc69 100644 --- a/dispander/module.py +++ b/dispander/module.py @@ -24,14 +24,13 @@ async def dispand(message): for m in messages: if m.content: await message.channel.send(embed=compose_embed(m)) - if len(m.attachments) >= 2: - # Send the second and subsequent attachments with embed (named 'embed') respectively: - for attachment in m.attachments[1:]: - embed = Embed() - embed.set_image( - url=attachment.proxy_url - ) - await message.channel.send(embed=embed) + # Send the second and subsequent attachments with embed (named 'embed') respectively: + for attachment in m.attachments[1:]: + embed = Embed() + embed.set_image( + url=attachment.proxy_url + ) + await message.channel.send(embed=embed) for embed in m.embeds: await message.channel.send(embed=embed)