logs: ignore embed events, send too long edits/deletes to pastebin
Also move default pastebin server from hastebin to mystbin.
This commit is contained in:
parent
3c8baf7055
commit
014c915590
2 changed files with 16 additions and 1 deletions
|
@ -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:
|
||||
|
|
15
cogs/logs.py
15
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):
|
||||
|
|
Loading…
Reference in a new issue