diff --git a/cogs/common.py b/cogs/common.py index dd92d0b..e097dc4 100644 --- a/cogs/common.py +++ b/cogs/common.py @@ -140,7 +140,7 @@ class Common: reply_list.append(f"{prefix}{text}{suffix}") return reply_list - async def haste(self, text, instance='https://hastebin.com/'): + async def haste(self, text, instance='https://mystb.in/'): response = await self.bot.aiosession.post(f"{instance}documents", data=text) if response.status == 200: diff --git a/cogs/logs.py b/cogs/logs.py index 3a8b10a..07fbea1 100644 --- a/cogs/logs.py +++ b/cogs/logs.py @@ -73,11 +73,21 @@ class Logs: if after.channel.id not in config.spy_channels or after.author.bot: return + # If content is the same, just skip over it + # This usually means that something embedded. + if before.clean_content == after.clean_content: + return + log_channel = self.bot.get_channel(config.log_channel) msg = "📝 **Message edit**: \n"\ f"from {self.bot.escape_message(after.author.name)} "\ f"({after.author.id})\n"\ f"`{before.clean_content}` → `{after.clean_content}`" + + # If resulting message is too long, upload to hastebin + if len(msg) > 2000: + msg = f"📝 **Message edit**: \nToo long: <{self.bot.haste(msg)}>" + await log_channel.send(msg) async def on_message_delete(self, message): @@ -89,6 +99,11 @@ class Logs: msg = "🗑️ **Message delete**: \n"\ f"from {self.bot.escape_message(message.author.name)} "\ f"({message.author.id})\n `{message.clean_content}`" + + # If resulting message is too long, upload to hastebin + if len(msg) > 2000: + msg = f"🗑️ **Message delete**: \nToo long: <{self.bot.haste(msg)}>" + await log_channel.send(msg) async def on_member_remove(self, member):