async def search_tags(self, ctx: KurisuContext, query: str): """Search tags by title. Returns first 10 results.""" if tags := await crud.search_tags(query): embed = discord.Embed(description='\n'.join( f'{n}. {tag.title}' for n, tag in enumerate(tags, start=1)), color=gen_color(ctx.author.id)) await ctx.send(embed=embed)
async def listreminders(self, ctx: KurisuContext): """Lists pending reminders.""" reminders = await crud.get_user_reminders(ctx.author.id) if not reminders: return await ctx.send("You don't have any reminders scheduled.") color = gen_color(ctx.author.id) view = PaginatedEmbedView(paginator=RemindersPaginator( reminders, color), author=ctx.author) view.message = await ctx.send(embed=view.paginator.current(), view=view)
async def tag(self, ctx: KurisuContext, tag_name: str = ""): """Command group for commands related to tags.""" if tag_name: if tag := self.tags.get(tag_name): await ctx.send(tag.content, reference=ctx.message.reference) elif tags := await crud.search_tags(tag_name, limit=5): embed = discord.Embed(description='\n'.join( f'{n}. {tag.title}' for n, tag in enumerate(tags, start=1)), color=gen_color(ctx.author.id)) await ctx.send("Tag not found, similar tags:", embed=embed)
async def list(self, ctx): """Lists the title of all existent tags.""" if tags := await crud.get_tags(): embeds = [] n = 1 color = gen_color(ctx.author.id) for x in [tags[i:i + 10] for i in range(0, len(tags), 10)]: embed = discord.Embed(description='\n'.join(f'{n}. {tag.title}' for n, tag in enumerate(x, start=n)), color=color) n += len(x) embeds.append(embed) view = utils.PaginatedEmbedView(embeds=embeds, author=ctx.author) view.message = await ctx.send(embed=view.embeds[0], view=view)
async def list_tags(self, ctx: KurisuContext): """Lists the title of all existent tags.""" if self.tags: colour = gen_color(ctx.author.id) view = PaginatedEmbedView(paginator=TagsPaginator(tags=list( self.tags.values()), tags_per_page=10, colour=colour), author=ctx.author) view.message = await ctx.send(embed=view.paginator.current(), view=view) else: await ctx.send("There are no tags.")
async def listreminders(self, ctx): reminders = await crud.get_user_reminders(ctx.author.id) if not reminders: return await ctx.send("You don't have any reminders scheduled.") embeds = [] color = utils.gen_color(ctx.author.id) for n, reminder in enumerate(reminders, start=1): embed = discord.Embed(title=f"Reminder {n}", color=color) embed.add_field(name='Content', value=reminder.reminder, inline=False) embed.add_field(name='Set to', value=utils.dtm_to_discord_timestamp(reminder.date), inline=False) embeds.append(embed) view = utils.PaginatedEmbedView(embeds, author=ctx.author) view.message = await ctx.send(embed=embeds[0], view=view)
async def reference(self, ctx: GuildContext, message: discord.Message, ref_text: bool = True, ref_image: bool = True, ref_author: bool = False): """Creates a embed with the contents of message. Trusted, Helpers, Staff, Retired Staff, Verified only.""" await ctx.message.delete() msg_reference = ctx.message.reference or None mention_author = any(ctx.message.mentions) ref_author = ref_author if await check_staff_id( 'Helper', ctx.author.id) else True if isinstance(message.channel, discord.abc.PrivateChannel): return await ctx.send("Message can't be from a DM.") if not isinstance(message.channel, discord.abc.GuildChannel): return await ctx.send("Failed to fetch channel information.") # xnoeproofingâ„¢ if not message.channel.permissions_for(ctx.author).read_messages: return await ctx.send("bad xnoe, bad", delete_after=10) embed = discord.Embed(colour=gen_color(message.author.id), timestamp=message.created_at) if ref_text and message.content: embed.description = message.content file = None if ref_image and len(message.attachments) > 0 and message.attachments[ 0].height and message.attachments[ 0].content_type and message.attachments[ 0].content_type.startswith("image/"): file = await message.attachments[0].to_file() embed.set_image(url=f"attachment://{file.filename}") if embed.description is None and embed.image is None: return await ctx.send("No information to reference!", delete_after=10) embed.set_author(name=message.author, icon_url=message.author.display_avatar.url, url=message.jump_url) embed.set_footer( text= f"in {message.channel.name}{f'. Ref by {ctx.author}' if ref_author else ''}" ) await ctx.send(file=file, embed=embed, reference=msg_reference, mention_author=mention_author)
async def userinfo2(self, ctx, user: Union[discord.Member, discord.User] = None): """Shows information from a user. Staff and Helpers only.""" if user is None: user = ctx.author if (not await check_staff_id('Helper', ctx.author.id)) and ( ctx.author != user or ctx.channel != self.bot.channels['bot-cmds']): await ctx.message.delete() return await ctx.send( f"{ctx.author.mention} This command can only be used in {self.bot.channels['bot-cmds'].mention} and only on yourself.", delete_after=10) embed = discord.Embed(color=utils.gen_color(user.id)) embed.description = ( f"**User:** {user.mention}\n" f"**User's ID:** {user.id}\n" f"**Created on:** {user.created_at}\n" f"**Default Profile Picture:** {user.default_avatar}\n") if isinstance(user, discord.Member): member_type = "member" embed.description += ( f"**Join date:** {user.joined_at}\n" f"**Current Status:** {user.status}\n" f"**User Activity:**: {user.activity}\n" f"**Current Display Name:** {user.display_name}\n" f"**Nitro Boost Info:** {user.premium_since}\n" f"**Current Top Role:** {user.top_role}\n" f"**Color:** {user.color}\n") else: member_type = "user" try: ban = await ctx.guild.fetch_ban(user) embed.description += f"\n**Banned**, reason: {ban.reason}" except discord.NotFound: pass member_type = member_type if not user.bot else "bot" embed.title = f"**Userinfo for {member_type} {user}**" embed.set_thumbnail(url=str(user.avatar_url_as(static_format='png'))) await ctx.send(embed=embed)
async def scan_message(self, message: discord.Message, is_edit=False): # Some assumptions that should be true always assert isinstance( message.channel, (discord.TextChannel, discord.VoiceChannel, discord.Thread)) assert isinstance(message.author, discord.Member) random.seed(message.id) embed = discord.Embed(color=gen_color(message.id)) embed.description = message.content if await crud.is_watched(message.author.id): content = f"**Channel**:\n[#{message.channel.name}]({message.jump_url})\n" msg = message.author.mention if message.attachments: content += "**Images**:\n" for c, f in enumerate(message.attachments): if f.filename.lower().endswith( self.ignored_file_extensions): content += f"[[{c + 1}]]({f.url}) " if f == message.attachments[-1]: content += "\n" if message.content: content += "**Message**:\n" embed.description = content + embed.description if is_edit: msg += " (edited)" await self.bot.channels['watch-logs'].send(msg, embed=embed) msg = ''.join(char for char in message.content.lower() if char in printable) msg_no_separators = re.sub(r'[ *_\-~]', '', msg) log_msg, wf_matches = self.bot.wordfilter.search_word(msg) lf_matches = self.bot.levenshteinfilter.search_site( msg, 'scamming site') contains_video, contains_piracy_video = self.bot.wordfilter.search_video( msg) approved_invites, non_approved_invites = self.bot.invitefilter.search_invite( message.content) contains_misinformation_url_mention = any( x in msg_no_separators for x in ('gudie.racklab', 'guide.racklab', 'gudieracklab', 'guideracklab', 'lyricly.github.io', 'lyriclygithub', 'strawpoii', 'hackinformer.com', 'console.guide', 'jacksorrell.co.uk', 'jacksorrell.tv', 'nintendobrew.com', 'reinx.guide', 'NxpeNwz', 'scenefolks.com', 'rentry.co')) contains_invite_link = approved_invites or non_approved_invites for f in message.attachments: if not f.filename.lower().endswith(self.ignored_file_extensions): embed2 = discord.Embed( description=f"Size: {f.size}\n" f"Message: [{message.channel.name}]({message.jump_url})\n" f"Download: [{f.filename}]({f.url})") await self.bot.channels['upload-logs'].send( f"📎 **Attachment**: {message.author.mention} " f"uploaded to {message.channel.mention}", embed=embed2) if contains_invite_link: await self.bot.channels['message-logs'].send( f"✉️ **Invite posted**: {message.author.mention} posted an invite link in {message.channel.mention}" f" {'(message deleted)' if non_approved_invites else ''}" f"\n------------------\n" f"{self.bot.escape_text(message.content)}") if non_approved_invites: try: await message.delete() except discord.NotFound: pass try: await message.author.send( f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"Server invites must be approved by staff. To contact staff send a message to <@333857992170536961>." ) except discord.errors.Forbidden: pass for invite in approved_invites: if invite.is_temporary: if invite.uses > 1: await self.bot.invitefilter.set_uses(code=invite.code, uses=invite.uses - 1) else: await self.bot.invitefilter.delete(code=invite.code) if contains_misinformation_url_mention: try: await message.delete() except discord.errors.NotFound: pass await send_dm_message( message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"This site may be misinterpreted as legitimate and cause users harm, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a blocked site in {message.channel.mention} (message deleted)", embed=embed) if wf_matches['piracy tool']: embed.description = log_msg try: await message.delete() except discord.errors.NotFound: pass await send_dm_message( message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention tools used for piracy directly or indirectly, " f"therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad tool**: {message.author.mention} mentioned a piracy tool in {message.channel.mention} (message deleted)", embed=embed) if lf_matches: embed.description = msg try: await message.delete() except discord.errors.NotFound: pass await self.bot.channels['message-logs'].send( f"**Scamming Site**: {message.author.mention} likely mentioned a scamming site in {message.channel.mention} (message deleted)", embed=embed) if contains_piracy_video: try: await message.delete() except discord.errors.NotFound: pass await send_dm_message( message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot link videos that mention piracy, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad video**: {message.author.mention} linked a banned video in {message.channel.mention} (message deleted)", embed=embed) if wf_matches['piracy tool alert']: embed.description = log_msg await self.bot.channels['message-logs'].send( f"**Bad tool**: {message.author.mention} likely mentioned a piracy tool in {message.channel.mention}", embed=embed) if wf_matches['piracy site']: embed.description = log_msg try: await message.delete() except discord.errors.NotFound: pass await send_dm_message( message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention sites used for piracy directly or indirectly, " f"therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a piracy site directly in {message.channel.mention} (message deleted)", embed=embed) if wf_matches['unbanning tool']: embed.description = log_msg try: await message.delete() except discord.errors.NotFound: pass await send_dm_message( message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention sites, programs or services used for unbanning, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned an unbanning site/service/program directly in {message.channel.mention} (message deleted)", embed=embed) if contains_video and message.channel in self.bot.assistance_channels: await self.bot.channels['message-logs'].send( f"▶️ **Video posted**: {message.author.mention} posted a video in {message.channel.mention}\n------------------\n{message.clean_content}" ) if lf_matches or wf_matches['scamming site']: if message.author.id not in self.userbot_yeeter: self.userbot_yeeter[message.author.id] = [] if message.channel not in self.userbot_yeeter[message.author.id]: self.userbot_yeeter[message.author.id].append(message.channel) if len(self.userbot_yeeter[message.author.id]) == 2: msg = ( "You have been banned from Nintendo Homebrew for linking scamming sites in multiple channels. " "If you think this is a mistake contact ❅FrozenFire❆#0700 on discord or send a email to [email protected]" ) await send_dm_message(message.author, msg) self.bot.actions.append('wb:' + str(message.author.id)) await message.author.ban( reason="Linking scamming links in multiple channels.") try: await message.delete() except discord.errors.NotFound: pass return else: self.bot.loop.create_task(self.userbot_yeeter_pop(message)) if wf_matches['scamming site']: embed.description = log_msg try: await message.delete() except discord.errors.NotFound: pass await crud.add_permanent_role(message.author.id, self.bot.roles['Probation'].id) await message.author.add_roles(self.bot.roles['Probation']) await send_dm_message( message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You have been probated for posting a link to a scamming site.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a scamming site in {message.channel.mention} (message deleted, user probated)", embed=embed) await self.bot.channels['mods'].send( f"🔇 **Auto-probated**: {message.author.mention} probated for linking scamming site | {message.author}\n" f"🗓 __Creation__: {message.author.created_at}\n" f"🏷__User ID__: {message.author.id}\n" f"See {self.bot.channels['message-logs'].mention} for the deleted message. @here", allowed_mentions=discord.AllowedMentions(everyone=True)) # check for mention spam if len(message.mentions) >= 6: log_msg = f"🚫 **Auto-probate**: {message.author.mention} probated for mass user mentions | {message.author}\n" \ f"🗓 __Creation__: {message.author.created_at}\n🏷 __User ID__: {message.author.id}" embed = discord.Embed(title="Deleted message", color=discord.Color.gold()) embed.add_field(name="#" + message.channel.name, value="\u200b" + message.content) await self.bot.channels['mod-logs'].send(log_msg, embed=embed) await self.bot.channels['mods'].send( f"{log_msg}\nSee {self.bot.channels['mod-logs'].mention} for the deleted message. @here", allowed_mentions=discord.AllowedMentions(everyone=True)) try: await message.delete() except discord.errors.NotFound: pass await send_dm_message( message.author, f"You were automatically placed under probation in {self.bot.guild.name} for mass user mentions." ) await crud.add_permanent_role(message.author.id, self.bot.roles['Probation'].id) await message.author.add_roles(self.bot.roles['Probation'])
async def scan_message(self, message, is_edit=False): random.seed(message.id) embed = discord.Embed(color=utils.gen_color(message.id)) embed.description = message.content if await crud.is_watched(message.author.id): content = f"**Channel**:\n[#{message.channel.name}]({message.jump_url})\n" msg = message.author.mention if message.attachments: content += "**Images**:\n" for c, f in enumerate(message.attachments): if f.filename.lower().endswith(self.ignored_file_extensions): content += f"[[{c + 1}]]({f.url}) " if f == message.attachments[-1]: content += "\n" if message.content: content += "**Message**:\n" embed.description = content + embed.description if is_edit: msg += " (edited)" await self.bot.channels['watch-logs'].send(msg, embed=embed) is_help_channel = message.channel in self.bot.assistance_channels msg = ''.join(char for char in message.content.lower() if char in printable) msg_no_separators = re.sub(r'[ *_\-~]', '', msg) contains_skype_link = "join.skype.com" in msg contains_piracy_site_mention = self.search_word(self.bot.wordfilter.filter['piracy site'], msg_no_separators, msg) contains_piracy_tool_mention = self.search_word(self.bot.wordfilter.filter['piracy tool'], msg_no_separators, msg) contains_scamming_site_levenshtein = self.levenshtein_search_word(self.bot.levenshteinfilter.filter['scamming site'], self.bot.levenshteinfilter.whitelist, message.content) # modified regular expresion made by deme72 res = re.findall(r'(?:(?:https?://)?(?:www.)?)(?:(?:youtube\.com/watch\?v=)|(?:youtu\.be/))([aA-zZ_\-\d]{11})', message.content) contains_video = any(res) contains_piracy_video_id = False if not contains_video else any(x for x in res if x in self.bot.wordfilter.filter['piracy video']) res = re.findall(r'(?:discordapp\.com/invite|discord\.gg)/([\w]+)', message.content) approved_invites = [x for x in self.bot.invitefilter.invites if x.code in res] contains_non_approved_invite = len(res) != len(approved_invites) contains_piracy_tool_alert_mention = self.search_word(self.bot.wordfilter.filter['piracy tool alert'], msg_no_separators, msg) contains_scamming_site = self.search_word(self.bot.wordfilter.filter['scamming site'], msg_no_separators, msg) contains_piracy_site_mention_indirect = any(x in msg for x in ('iso site', 'chaos site',)) contains_misinformation_url_mention = any(x in msg_no_separators for x in ('gudie.racklab', 'guide.racklab', 'gudieracklab', 'guideracklab', 'lyricly.github.io', 'lyriclygithub', 'strawpoii', 'hackinformer.com', 'console.guide', 'jacksorrell.co.uk', 'jacksorrell.tv', 'nintendobrew.com', 'reinx.guide', 'NxpeNwz', 'scenefolks.com')) contains_unbanning_stuff = self.search_word(self.bot.wordfilter.filter['unbanning tool'], msg_no_separators, msg) contains_invite_link = contains_non_approved_invite or contains_skype_link or approved_invites # contains_guide_mirror_mention = any(x in msg for x in ('3ds-guide.b4k.co',)) contains_drama_alert = self.search_word(self.bot.wordfilter.filter['drama'], msg_no_separators, msg) for f in message.attachments: if not f.filename.lower().endswith(self.ignored_file_extensions): embed2 = discord.Embed(description=f"Size: {f.size}\n" f"Message: [{message.channel.name}]({message.jump_url})\n" f"Download: [{f.filename}]({f.url})") await self.bot.channels['upload-logs'].send(f"📎 **Attachment**: {message.author.mention} " f"uploaded to {message.channel.mention}", embed=embed2) if contains_invite_link: await self.bot.channels['message-logs'].send( f"✉️ **Invite posted**: {message.author.mention} posted an invite link in {message.channel.mention}" f" {'(message deleted)' if contains_non_approved_invite else ''}" f"\n------------------\n" f"{self.bot.escape_text(message.content)}") if contains_non_approved_invite: try: await message.delete() except discord.NotFound: pass try: await message.author.send( f"Please read {self.bot.channels['welcome-and-rules'].mention}. " "Server invites must be approved by staff. To contact staff send a message to <@333857992170536961>.") except discord.errors.Forbidden: pass if approved_invites: for invite in approved_invites: if invite.is_temporary: if invite.uses > 1: await self.bot.invitefilter.set_uses(code=invite.code, uses=invite.uses - 1) else: await self.bot.invitefilter.delete(code=invite.code) if contains_misinformation_url_mention: try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"This site may be misinterpreted as legitimate and cause users harm, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a blocked site in {message.channel.mention} (message deleted)", embed=embed) if contains_drama_alert: embed.description = contains_drama_alert await self.bot.channels['message-logs'].send( f"**Potential drama/heated debate Warning**: {message.author.mention} posted a blacklisted word in {message.channel.mention}", embed=embed) if contains_piracy_tool_mention: embed.description = self.highlight_matches(contains_piracy_tool_mention, msg) try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention tools used for piracy, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad tool**: {message.author.mention} mentioned a piracy tool in {message.channel.mention} (message deleted)", embed=embed) if contains_scamming_site_levenshtein: embed.description = msg try: await message.delete() except discord.errors.NotFound: pass await self.bot.channels['message-logs'].send( f"**Scamming Site**: {message.author.mention} likely mentioned a scamming site in {message.channel.mention} (message deleted)", embed=embed) if contains_piracy_video_id: try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot link videos that mention piracy, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad video**: {message.author.mention} linked a banned video in {message.channel.mention} (message deleted)", embed=embed) if contains_piracy_tool_alert_mention: embed.description = self.highlight_matches(contains_piracy_tool_alert_mention, msg) await self.bot.channels['message-logs'].send( f"**Bad tool**: {message.author.mention} likely mentioned a piracy tool in {message.channel.mention}", embed=embed) if contains_piracy_site_mention: embed.description = self.highlight_matches(contains_piracy_site_mention, msg) try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention sites used for piracy directly, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a piracy site directly in {message.channel.mention} (message deleted)", embed=embed) elif contains_piracy_site_mention_indirect: if is_help_channel: try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention sites used for piracy in the help-and-questions channels directly or indirectly, " f"therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a piracy site indirectly in {message.channel.mention}{' (message deleted)' if is_help_channel else ''}", embed=embed) if contains_unbanning_stuff: embed.description = self.highlight_matches(contains_unbanning_stuff, msg) try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You cannot mention sites, programs or services used for unbanning, therefore your message was automatically deleted.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned an unbanning site/service/program directly in {message.channel.mention} (message deleted)", embed=embed) if contains_video and message.channel in self.bot.assistance_channels: await self.bot.channels['message-logs'].send( f"▶️ **Video posted**: {message.author.mention} posted a video in {message.channel.mention}\n------------------\n{message.clean_content}") if contains_scamming_site: embed.description = self.highlight_matches(contains_scamming_site, msg) try: await message.delete() except discord.errors.NotFound: pass await crud.add_permanent_role(message.author.id, self.bot.roles['Probation'].id) await message.author.add_roles(self.bot.roles['Probation']) await utils.send_dm_message(message.author, f"Please read {self.bot.channels['welcome-and-rules'].mention}. " f"You have been probated for posting a link to a scamming site.", embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a scamming site in {message.channel.mention} (message deleted, user probated)", embed=embed) await self.bot.channels['mods'].send( f"🔇 **Auto-probated**: {message.author.mention} probated for linking scamming site | {message.author}\n" f"🗓 __Creation__: {message.author.created_at}\n" f"🏷__User ID__: {message.author.id}\n" f"See {self.bot.channels['message-logs'].mention} for the deleted message. @here", allowed_mentions=discord.AllowedMentions(everyone=True)) # check for guide mirrors and post the actual link urls = re.findall(r'(https?://\S+)', msg) to_replace = [] for url in set(urls): ps = urlparse(url) if ps.netloc.startswith('3ds-guide.b4k.co'): to_replace.append(ps._replace(netloc='3ds.hacks.guide').geturl()) elif ps.netloc.startswith('hax.b4k.co') and ps.path.startswith('/3ds/guide'): to_replace.append(ps._replace(netloc='3ds.guide', path=ps.query[2:], query='').geturl()) if to_replace: msg_user = f"Please read {self.bot.channels['welcome-and-rules'].mention}. " \ f"Guide mirrors may not be linked to, therefore your message was automatically deleted.\n" \ f"Please link to <https://3ds.guide> or <https://wiiu.guide> directly instead of mirrors of the sites.\n\n" \ f"The official equivalents of the links are:" for url in to_replace: msg_user += '\n• ' + url try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message(message.author, msg_user, embed=embed) await self.bot.channels['message-logs'].send( f"**Bad site**: {message.author.mention} mentioned a blocked guide mirror in {message.channel.mention} (message deleted)", embed=embed) # check for mention spam if len(message.mentions) >= 6 and not self.bot.roles['Helpers'] in message.author.roles: log_msg = f"🚫 **Auto-probate**: {message.author.mention} probated for mass user mentions | {message.author}\n" \ f"🗓 __Creation__: {message.author.created_at}\n🏷 __User ID__: {message.author.id}" embed = discord.Embed(title="Deleted message", color=discord.Color.gold()) embed.add_field(name="#" + message.channel.name, value="\u200b" + message.content) await self.bot.channels['mod-logs'].send(log_msg, embed=embed) await self.bot.channels['mods'].send( f"{log_msg}\nSee {self.bot.channels['mod-logs'].mention} for the deleted message. @here", allowed_mentions=discord.AllowedMentions(everyone=True)) try: await message.delete() except discord.errors.NotFound: pass await utils.send_dm_message( message.author, f"You were automatically placed under probation in {self.bot.guild.name} for mass user mentions.") await crud.add_permanent_role(message.author.id, self.bot.roles['Probation'].id) await message.author.add_roles(self.bot.roles['Probation'])