From e73b388d46a4a5def2c9cf4ca53238884ccfa72c Mon Sep 17 00:00:00 2001 From: timofey Date: Thu, 4 May 2023 21:37:58 +0000 Subject: [PATCH] optimised edit --- constitution | 2 +- v6d3losyash/run-bot.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/constitution b/constitution index 27c1811..dda33a1 160000 --- a/constitution +++ b/constitution @@ -1 +1 @@ -Subproject commit 27c18118c58abecf4a91e4bcab41099a54afeb5b +Subproject commit dda33a1de49e95edb55b6556b906b55a26963266 diff --git a/v6d3losyash/run-bot.py b/v6d3losyash/run-bot.py index 0a9cd6e..59820fa 100644 --- a/v6d3losyash/run-bot.py +++ b/v6d3losyash/run-bot.py @@ -130,6 +130,7 @@ class Spam: return None broken_order = False for i, (segment, embeds, flags) in enumerate(await self.ru_segments()): + content = segment.strip() dbkey = (channel.id, i) message = None messageid: int | None @@ -141,11 +142,12 @@ class Spam: ): if broken_order and message is not None: await message.delete() - message = await channel.send(content=segment.strip(), embeds=embeds) + message = await channel.send(content=content, embeds=embeds) await spam_db.set(dbkey, message.id) broken_order = True else: - await message.edit(content=segment.strip(), embeds=embeds) + if content != message.content or embeds != message.embeds: + await message.edit(content=content, embeds=embeds) emojiid: int for emojiid in flags.get('emojis', []): emoji = await guild.fetch_emoji(emojiid)