From 45df6b19fc0942e10a39bf9293b967e557ddac5b Mon Sep 17 00:00:00 2001 From: JustMaffie Date: Sat, 29 Jul 2017 23:52:24 +0200 Subject: [PATCH] Added a protection against crash chars that make discord crash, this is not available to be disabled, this only helps out your server. --- discordbot/titanembeds/bot.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index a6eb05e..a6327b3 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -110,6 +110,17 @@ class Titan(discord.Client): print("Skipping indexing server due to no-init flag") async def on_message(self, message): + crashChar = 'ौौौौ' + if crashChar in message.content: + try: + await bot.delete_message(message) + await bot.send_message(message.channel, + "**I've delete a message posted by {} because it contained characters which crashes discord. I've also banned him.**".format( + message.author.name + "#" + message.author.discriminator + "(ID: " + message.author.id + ")")) + await message.server.ban(message.author, "Causing discord to crash because of weird characters.") + except: + pass + return await self.wait_until_dbonline() await self.database.push_message(message)