async def on_message(self, message): if not self.Init(message): return guild = message.guild self.store[guild.id][message.author.id]["String"] = message.content self.store[guild.id][message.author.id]["Count"] = 0 self.store[guild.id][message.author.id]["Count"] = len( re.findall(u'[\U00010000-\U0010ffff]', message.content)) # Normal Emojis self.store[guild.id][message.author.id]["Count"] += len( re.findall( '<(?P<animated>a)?:(?P<name>[0-9a-zA-Z_]{2,32}):(?P<id>[0-9]{15,21})>', message.content)) # Custom Emojis if self.store[guild.id][message.author.id]["Count"] > self.bot.cache[ guild.id]["AutoMod"][4]["Ratelimit"]: member = message.author await message.channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Emojis")), delete_after=30) if self.bot.cache[message.guild.id]["AutoMod"][4]["Enabled"] == 1: if self.bot.cache[message.guild.id]["Logs"]: channel = await self.bot.fetch_channel( self.bot.cache[message.guild.id]["Logs"]) await channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Emojis"))) sql.Warn( guild.id, member.id, 702141833437773824, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Emojis")) sql.LogMe( guild.id, 9, "{} {}. {}: {}".format( Language.get(message.guild.id, self.bot.cache, "AutoMod", "Warned"), member.name, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Reason"), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Emojis"))) await Rules.DoRule(self, member, message.guild, self.bot.tobemuted, self.bot.tobekicked, self.bot.tobebanned) try: await message.delete() except: pass self.store[guild.id][member.id]['Count'] = 0 self.store[guild.id][member.id]['String'] = None
async def on_message(self, message): if not self.Init(message): return guild = message.guild self.store[message.guild.id][message.author.id] += 1 if self.store[guild.id][message.author.id] >= self.bot.cache[ guild.id]["AutoMod"][8]["Ratelimit"]: member = message.author await message.channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Spam")), delete_after=30) if self.bot.cache[message.guild.id]["AutoMod"][8]["Enabled"] == 1: if self.bot.cache[message.guild.id]["Logs"]: channel = await self.bot.fetch_channel( self.bot.cache[message.guild.id]["Logs"]) await channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Spam"))) sql.Warn( guild.id, member.id, 702141833437773824, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Spam")) sql.LogMe( guild.id, 9, "{} {}. {}: {}".format( Language.get(message.guild.id, self.bot.cache, "AutoMod", "Warned"), member.name, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Reason"), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Spam"))) await Rules.DoRule(self, member, message.guild, self.bot.tobemuted, self.bot.tobekicked, self.bot.tobebanned) try: msgs = [] async for messagea in message.channel.history( limit=self.bot.cache[ guild.id]["AutoMod"][8]["Ratelimit"]): if member == messagea.author: msgs.append(messagea) await message.channel.delete_messages(msgs) msgs.clear() except: pass self.store[guild.id][member.id] = 0
async def on_message(self, message): if not self.Init(message): return guild = message.guild filetypes = [ '.exe', '.py', '.dll', '.xls', '.doc', '.xlsx', '.docx', '.vbs', '.sln', '.application', '.com', '.cpl' ] for i in message.attachments: for f in filetypes: j = i.filename.lower() if j.endswith(f): self.store[guild.id] = True if self.store[guild.id] == True: member = message.author await message.channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "File")), delete_after=30) if self.bot.cache[message.guild.id]["AutoMod"][9]["Enabled"] == 1: if self.bot.cache[message.guild.id]["Logs"]: channel = await self.bot.fetch_channel( self.bot.cache[message.guild.id]["Logs"]) await channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "File"))) sql.Warn( guild.id, member.id, 702141833437773824, Language.get(message.guild.id, self.bot.cache, "AutoMod", "File")) sql.LogMe( guild.id, 9, "{} {}. {}: {}".format( Language.get(message.guild.id, self.bot.cache, "AutoMod", "Warned"), member.name, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Reason"), Language.get(message.guild.id, self.bot.cache, "AutoMod", "File"))) await Rules.DoRule(self, member, message.guild, self.bot.tobemuted, self.bot.tobekicked, self.bot.tobebanned) try: await message.delete() except: pass self.store[guild.id] = False
async def on_message_edit(self, before, after): if not self.Init(after): return guild = after.guild text = after.content.replace('*', '') censored = profanity.censor(text) if '*' in censored: member = after.author await after.channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(after.guild.id, self.bot.cache, "AutoMod", "Swearing")), delete_after=30) if self.bot.cache[after.guild.id]["AutoMod"][7]["Enabled"] == 1: if self.bot.cache[after.guild.id]["Logs"]: channel = await self.bot.fetch_channel( self.bot.cache[after.guild.id]["Logs"]) await channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(after.guild.id, self.bot.cache, "AutoMod", "Swearing"))) sql.Warn( guild.id, member.id, 702141833437773824, Language.get(after.guild.id, self.bot.cache, "AutoMod", "Swearing")) sql.LogMe( guild.id, 9, "{} {}. {}: {}".format( Language.get(after.guild.id, self.bot.cache, "AutoMod", "Warned"), member.name, Language.get(after.guild.id, self.bot.cache, "AutoMod", "Reason"), Language.get(after.guild.id, self.bot.cache, "AutoMod", "Swearing"))) await Rules.DoRule(self, member, after.guild, self.bot.tobemuted, self.bot.tobekicked, self.bot.tobebanned) try: await after.delete() except: pass
async def infractions(self, ctx, member: discord.Member = None): if not ctx.author.guild_permissions.manage_messages: return await ctx.send(embed=func.NoPerm(self, ctx.guild.id), delete_after=15) if not member: return await ctx.send(embed=func.BadResponseEmbed( self, ctx.guild.id, Language.get(ctx.guild.id, self.bot.cache, "Moderator", "Errors", "NoInfractionsUser")), delete_after=15) infr = sql.GetInfractions(ctx.guild.id, member.id) if not infr: return await ctx.send(embed=func.BadResponseEmbed( self, ctx.guild.id, "{} {}".format( member.mention, Language.get(ctx.guild.id, self.bot.cache, "Moderator", "Errors", "HasNoInfractions"))), delete_after=15) embed = discord.Embed(colour=0x27b1db) for i in infr: u = await self.bot.fetch_user(i[3]) desc = "{} {} {} @ {} | {}: {}".format( member.mention, Language.get(ctx.guild.id, self.bot.cache, "Moderator", "WarnedBy"), u.mention, i[5], Language.get(ctx.guild.id, self.bot.cache, "Moderator", "Reason"), i[4]) embed.add_field(name="{}: {}".format( Language.get(ctx.guild.id, self.bot.cache, "Moderator", "InfractID"), i[0]), value=desc, inline=False) await ctx.send(embed=embed)
async def on_message(self, message): if not self.Init(message): return guild = message.guild self.store[guild.id][message.author.id]['Percentage'] = 0 self.store[guild.id][message.author.id]['String'] = list( message.content.lower().split()) self.store[guild.id][message.author.id]['Unique'] = [] for i in self.store[guild.id][message.author.id]['String']: if not i in self.store[guild.id][message.author.id]['Unique']: self.store[guild.id][message.author.id]['Unique'].append(i) self.store[guild.id][message.author.id]['Percentage'] = ( len(self.store[guild.id][message.author.id]['Unique']) / len(message.content.lower().split()) * 100) if self.store[guild.id][ message.author.id]['Percentage'] >= self.bot.cache[ guild.id]["AutoMod"][1]["Ratelimit"]: member = message.author await message.channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Repeated")), delete_after=30) if self.bot.cache[message.guild.id]["AutoMod"][1]["Enabled"] == 1: if self.bot.cache[message.guild.id]["Logs"]: channel = await self.bot.fetch_channel( self.bot.cache[message.guild.id]["Logs"]) await channel.send(embed=func.AutoModInfraction( self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Repeated"))) sql.Warn( guild.id, member.id, 702141833437773824, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Repeated")) sql.LogMe( guild.id, 9, "{} {}. {}: {}".format( Language.get(message.guild.id, self.bot.cache, "AutoMod", "Warned"), member.name, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Reason"), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Repeated"))) await Rules.DoRule(self, member, message.guild, self.bot.tobemuted, self.bot.tobekicked, self.bot.tobebanned) try: await message.delete() except: pass self.store[guild.id][message.author.id]['Percentage'] = 0 self.store[guild.id][message.author.id]['String'] = None self.store[guild.id][message.author.id]['Unique'] = []
async def on_message(self, message): if not self.Init(message): return guild = message.guild self.store[guild.id][message.author.id]["String"] = message.content self.store[guild.id][message.author.id]["Count"] = 0 for i in message.content: if(i.isupper()): self.store[guild.id][message.author.id]["Count"] += 1 self.store[guild.id][message.author.id]["Percentage"] = self.store[guild.id][message.author.id]["Count"] / len(self.store[guild.id][message.author.id]["String"]) * 100 if self.store[guild.id][message.author.id]["Percentage"] >= self.bot.cache[guild.id]["AutoMod"][3]["Ratelimit"]: member = message.author await message.channel.send(embed=func.AutoModInfraction(self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Caps")), delete_after=30) if self.bot.cache[message.guild.id]["AutoMod"][3]["Enabled"] == 1: if self.bot.cache[message.guild.id]["Logs"]: channel = await self.bot.fetch_channel(self.bot.cache[message.guild.id]["Logs"]) await channel.send(embed=func.AutoModInfraction(self, guild, member, len(sql.GetInfractions(guild.id, member.id)), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Caps"))) sql.Warn(guild.id, member.id, 702141833437773824, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Caps")) sql.LogMe(guild.id, 9, "{} {}. {}: {}".format(Language.get(message.guild.id, self.bot.cache, "AutoMod", "Warned"), member.name, Language.get(message.guild.id, self.bot.cache, "AutoMod", "Reason"), Language.get(message.guild.id, self.bot.cache, "AutoMod", "Caps"))) await Rules.DoRule(self, member, message.guild, self.bot.tobemuted, self.bot.tobekicked, self.bot.tobebanned) try: await message.delete() except: pass self.store[guild.id][member.id]['Count'] = 0 self.store[guild.id][member.id]['Percentage'] = 0 self.store[guild.id][member.id]['String'] = None