async def dashboard_server(guild_id): if not await discord_auth.authorized: return redirect(url_for("login")) guild = await ipc_client.request("get_guild", guild_id=guild_id) commands = await ipc_client.request("get_all_commands") cogs = await ipc_client.request("get_all_cogs") channels = await ipc_client.request("get_all_channels", guild_id=guild_id) _db_important_channels = get_cluster(guild_id, "CLUSTER_CHANNELS").find_one({ "id": "type_important_channels" })["dict"] _db_commands = get_cluster(guild_id, "CLUSTER_CHANNELS").find_one( {"id": "type_command_activity"})["dict"] _db_warns = get_cluster(guild_id, "CLUSTER_WARN").find().sort("time", -1) if guild is None: return redirect( f'https://discord.com/oauth2/authorize?&client_id={app.config["DISCORD_CLIENT_ID"]}&scope=bot&permissions=8&guild_id={guild_id}&response_type=code&redirect_uri={app.config["DISCORD_REDIRECT_URI"]}' ) return await render_template( "guild_id.html", guild=guild, _db_important_channels=_db_important_channels, commands=commands, _db_commands=_db_commands, cogs=cogs, _db_warns=_db_warns, channels=channels)
async def on_ready(self): await self.bot.wait_until_ready() collections = [ collection for collection in self.bot.mongo_client.database_names() if represents_int(collection) ] for collection in collections: _db = get_cluster(int(collection), "CLUSTER_COMMANDS") db = _db.find_one({"id": "type_command_activity"}) update = {} if db is None: db = _db.insert_one({ "id": "type_command_activity", "dict": {} }) db = _db.find_one({"id": "type_command_activity"}) command_db = db["dict"] for command in self.bot.commands: try: cmd = command_db[command.name] except KeyError: update[f"dict.{command.name}"] = 1 if update: _db.update_one({"id": "type_command_activity"}, {"$set": update})
async def _enable(self, ctx): f""" {self.bot.command_prefix}{ctx.command.name} """ new_activity_state = {} _db = get_cluster(ctx.guild.id, "CLUSTER_COMMANDS") commands = ctx.message.content.partition(' ')[2].split(" ") string = "" err_string = "" for command in commands: command = command.lower() if self.bot.get_command( command ) is not None and "disable" not in command and "enable" not in command: new_activity_state[f"dict.{command}"] = 1 string += f"`{command}`, " else: err_string += f"`{command}`, " if new_activity_state: _db.update_one({"id": "type_command_activity"}, {"$set": new_activity_state}) if err_string != "": await ctx.channel.send(embed=embed_error( f"Could not enable commands: {err_string[:-2]}")) if string != "": await ctx.channel.send( embed=embed_success(f"Enabled commands {string[:-2]}"))
async def _warn(self, ctx, member: discord.Member, *, reason="None"): f""" {self.bot.command_prefix}{ctx.command.name} <member> <reason> """ _db = get_cluster(ctx.guild.id, "CLUSTER_WARN") new_warn = ({ "warned_user_name": str(member), "warned_user_id": member.id, "warn_reason": reason, "moderator_name": str(ctx.author), "moderator_id": ctx.author.id, "time": datetime.utcnow() }) _db.insert(new_warn) embed = discord.Embed( title="", description=f" ", timestamp=datetime.utcnow(), color=0xff0000).set_author( name=f"{ctx.author} warned a user", icon_url=f"{ctx.author.avatar_url}").add_field( name="Warned User", value=f"{member.mention}").add_field(name="Reason", value=f"{reason}") log_channel = self.bot.get_channel( get_channel_id(member.guild.id, "channel_logs")) await log_channel.send(embed=embed) await ctx.channel.send(embed=embed)
async def _dick_size(self, ctx, member: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <user> """ if member == None: member = ctx.author _db = get_cluster(ctx.message.guild.id, "CLUSTER_DICK") _find_user = _db.find_one({"id": member.id}) if _find_user is None: dick_size = f"8{'='*random.randint(1,12)}3" new_dick_size = ({"id": member.id, "dick_size": dick_size}) _db.insert(new_dick_size) _find_user = _db.find_one({"id": member.id}) dick_size = _find_user["dick_size"] gayColor = 0xFFFFFF emb = discord.Embed(description=f"Dick size for **{member }**", color=gayColor) emb.add_field(name="Dick Size:", value=f"{dick_size}\n{len(dick_size)-1} Inches") emb.set_author( name="Dick-Detectorâ„¢", icon_url="https://static.thenounproject.com/png/113312-200.png") await ctx.send(embed=emb)
async def _leaderboard(self, ctx, placement=None): f""" {self.bot.command_prefix}{ctx.command.name} <number> """ await ctx.message.delete() if placement is None: raise MissingArgument("Placement number", get_command_description(ctx.command.name)) try: placement = int(placement) except: raise ExpectedLiteralInt _db = get_cluster(ctx.message.guild.id, "CLUSTER_EXPERIENCE") await ctx.channel.trigger_typing() stats = _db.find().sort("xp", -1) for i, stat in enumerate(list(stats)): if (i + 1) == placement: stats = stat break try: xp = stats["xp"] lvl = get_level(xp) xp -= ((50 * ((lvl - 1)**2)) + (50 * (lvl - 1))) rank = placement member = discord.utils.get(self.bot.get_all_members(), id=stats["id"]) except: await ctx.send( embed=embed_error(f"Member in place `{placement}` has no XP")) return try: colour = (stats["colour"][0], stats["colour"][1], stats["colour"][2]) except KeyError: colour = (65, 178, 138) try: background = (stats["background"]) except KeyError: background = "https://media.discordapp.net/attachments/665771066085474346/821993295310749716/statementofsolidarity.jpg?width=1617&height=910" try: create_rank_card(member, xp, lvl, rank, background, colour, ctx.guild.member_count) await ctx.send(file=discord.File( os.path.join(f"{IMAGE_PATH}//temp//", "card_temp.png"))) except: await ctx.send( embed=embed_error("That user is no longer in the server"))
async def _mute_user(self, ctx, member, time="Indefinite", reason="None"): channel = self.bot.get_channel( get_channel_id(member.guild.id, "channel_logs")) try: muted_role = get(ctx.guild.roles, name="Muted") except: await ctx.message.guild.create_role(name="Muted", colour=0x505050) if muted_role in member.roles: return await member.add_roles(muted_role) timestr = "" if str(time).endswith("d"): timestr += f"{str(time)[:-1]} day" if str( time)[:-1] == "1" else f"{str(time)[:-1]} days" elif str(time).endswith("h"): timestr += f"{str(time)[:-1]} hour" if str( time)[:-1] == "1" else f"{str(time)[:-1]} hour" elif str(time).endswith("m"): timestr += f"{str(time)[:-1]} minute" if str( time)[:-1] == "1" else f"{str(time)[:-1]} minutes" elif str(time).endswith("s"): timestr += f"{str(time)[:-1]} second" if str( time)[:-1] == "1" else f"{str(time)[:-1]} seconds" embed = discord.Embed( description=f" ", timestamp=datetime.utcnow(), color=0xff0000).set_author( name=f"{ctx.author} muted member", icon_url=f"{ctx.author.avatar_url}").add_field( name="Muted User", value=f"{member.mention}").add_field( name="Reason", value=f"{reason}").add_field(name="Time", value=f"{timestr}") await ctx.send(embed=embed) if time != 'Indefinite': time_to_seconds = int(re.findall( r'\d+', str(time))[0]) * converter( re.sub('[^a-zA-Z]+', '', time)) end_date = datetime.utcnow() + timedelta(seconds=time_to_seconds) _db = get_cluster(ctx.guild.id, "CLUSTER_MUTE") greenie = ({"id": member.id, "end_date": end_date}) _db.insert(greenie) await asyncio.sleep(time_to_seconds) else: await member.add_roles(muted_role)
async def _esnipe(self, ctx): f""" {self.bot.command_prefix}{ctx.command.name} """ try: before_edit = self.temp_message_edit_before after_edit = self.temp_message_edit_after except: await ctx.send("Nothing to snipe!") return if ctx.message.channel == self.temp_message_edit_before.channel: gif_arr = get_cluster(ctx.message.guild.id, "CLUSTER_GIFS").find_one({"id": "type_snipe_gifs"})["array"] before_edit_content = self.temp_message_edit_before.content after_edit_content = self.temp_message_edit_after.content try: for word in get_cluster(ctx.message.guild.id, "CLUSTER_BLACKLIST_WORDS").find_one({"id": "type_blacklist"})["array"]: before_edit_content = before_edit_content.lower().replace(word, "[redacted]") after_edit_content = after_edit_content.lower().replace(word, "[redacted]") except: pass message_id = before_edit.id channel_id = get_channel_id(ctx.message.guild.id, "channel_general") message_link = f"https://discord.com/channels/{ctx.message.guild.id}/{channel_id}" + f"/{message_id}" embed=discord.Embed( description=f"Message edited in: {before_edit.channel.mention}\n[Go To Message]({message_link})", timestamp=datetime.utcnow(), color=0x800080 ).set_author(name=f"{before_edit.author} was sniped!", icon_url=f"{before_edit.author.avatar_url}" ).add_field(name="Before", value=f"{before_edit_content}", inline=False ).add_field(name="After", value=f"{after_edit_content}" ).set_image(url=choice(gif_arr) ) await ctx.send(embed=embed)
async def _unmute(self, ctx, member: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <member> """ await ctx.message.delete() await ctx.channel.trigger_typing() _db = get_cluster(ctx.guild.id, "CLUSTER_MUTE") if member == None: member = ctx.message.author await self._unmute_user(member) _db.delete_many({'id': member.id})
async def _set_background(self, ctx, link="NoLinkSpecified"): f""" {self.bot.command_prefix}{ctx.command.name} <image_link> """ await ctx.trigger_typing() _db = get_cluster(ctx.message.guild.id, "CLUSTER_EXPERIENCE") if link == "NoLinkSpecified": if (len(ctx.message.attachments)) == 0: raise MissingArgument("Background Image Link", get_command_description(ctx.command.name)) link = ctx.message.attachments[0].url else: if not query_valid_url(link): raise InvalidURL _db.update_one({ "id": ctx.author.id}, {"$set":{ "background":link } }) stats = _db.find_one({"id": ctx.author.id}) xp = stats["xp"] lvl = get_level(xp) xp -= ((50*((lvl-1)**2))+(50*(lvl-1))) rank = get_rank(ctx.message.author, _db) try: colour = (stats["colour"][0],stats["colour"][1],stats["colour"][2]) except KeyError: colour = (65, 178, 138) try: background = (stats["background"]) except KeyError: background = "https://media.discordapp.net/attachments/665771066085474346/821993295310749716/statementofsolidarity.jpg?width=1617&height=910" create_rank_card(ctx.message.author, xp, lvl, rank, background, colour, ctx.guild.member_count) await ctx.send(file=discord.File(os.path.join(f"{IMAGE_PATH}//temp//","card_temp.png")))
async def _add_default_roles(self, ctx, *, roles): f""" {self.bot.command_prefix} <roles> """ try: [int(role) for role in roles.split()] except ValueError: raise ExpectedLiteralInt _db = get_cluster(ctx.message.guild.id, "CLUSTER_SERVER_ROLES") for role in roles.split(): _db.update({"id": "type_on_join_roles"}, {"$push": { "array": int(role) }})
async def _gay(self, ctx, member: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <@user> """ if member == None: member = ctx.author _db = get_cluster(ctx.message.guild.id, "CLUSTER_GAY") _find_user = _db.find_one({"id": member.id}) if _find_user is None: gayness = random.randint(0, 100) new_gay_client = ({"id": member.id, "gay_rating": gayness}) _db.insert(new_gay_client) _find_user = _db.find_one({"id": member.id}) gayness = _find_user["gay_rating"] if gayness <= 10: gayStatus = random.choice(GAY_RESPONSE_DICT["GAY_1"]) colour = 0xFFFFFF elif 10 < gayness < 33: gayStatus = random.choice(GAY_RESPONSE_DICT["GAY_2"]) colour = 0xFFC0CB elif 33 < gayness < 66: gayStatus = random.choice(GAY_RESPONSE_DICT["GAY_3"]) colour = 0xFF69B4 else: gayStatus = random.choice(GAY_RESPONSE_DICT["GAY_4"]) colour = 0xFF00FF embed = discord.Embed( description=f"Gayness for **{member }**", color=colour ).add_field(name="Gayness:", value=f"{gayness}% gay").add_field( name="Comment:", value=f"{gayStatus} :kiss_mm:" ).set_author( name="Gay-Scannerâ„¢", icon_url= "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/ICA_flag.svg/2000px-ICA_flag.svg.png" ) await ctx.send(embed=embed)
async def _snipe(self, ctx): f""" {self.bot.command_prefix}{ctx.command.name} """ if not deleted_messages: await ctx.send("Nothing to snipe!") return if ctx.message.channel == deleted_messages[0].channel: gif_arr = get_cluster(ctx.message.guild.id, "CLUSTER_GIFS").find_one({"id": "type_snipe_gifs"})["array"] strs = [x.content for x in deleted_messages] embed=discord.Embed( description=f"Message deleted in: {ctx.message.channel.mention} by {self.deletee.mention}", timestamp=datetime.utcnow(), color=0xff0000 ).set_author(name=f"{self.author_temp} just got sniped", icon_url=f"{self.author_temp.avatar_url}" ) for i, str in enumerate(strs): embed.add_field(name=f"Sniped Message {i + 1}", value=f"{str}", inline=False) embed.set_footer(text=f"ID - {self.author_temp.id}" ).set_image(url=choice(gif_arr)) try: await ctx.send(embed=embed) except: try: embed=discord.Embed( description=f"Message deleted in: {ctx.message.channel.mention}", timestamp=datetime.utcnow(), color=0xff0000 ).set_author(name=f"{self.author_temp} just got sniped", icon_url=f"{self.author_temp.avatar_url}") for i, str in enumerate(strs): embed.add_field(name=f"Sniped Message {i + 1}", value=f"{str}", inline=False) embed.set_footer(text=f"ID - {self.author_temp.id}" ).set_image(url=choice(gif_arr)) except: await ctx.send("Cannot Snipe message. Perhaps it contains no text?")
async def on_message(self, message: discord.Message): _db = get_cluster(message.guild.id, "CLUSTER_AFK") for member in message.mentions: find_user = _db.find_one({"id": member.id}) if find_user is None or "?afk" in message.content.lower(): return user_id = find_user["id"] afk_status = find_user["status"] afk_date = find_user["date"] time_afk = get_time_elapsed(afk_date) member_obj = await self.bot.fetch_user(int(user_id)) if str(user_id ) in message.content and message.author.id != user_id: embed = discord.Embed( description= f"This user is AFK! Please wait for them to return", timestamp=datetime.utcnow(), color=0x800080).set_author( name=f"{member_obj}", icon_url=f"{member_obj.avatar_url}").add_field( name="AFK Status", value=f"{afk_status}").add_field( name="Time AFK", value=f"{time_afk}") await message.channel.send(embed=embed) return find_user = _db.find_one({"id": message.author.id}) if find_user is not None: _db.delete_many({"id": message.author.id}) embed = discord.Embed( description= f"{message.author} is no longer AFK after {get_time_elapsed(find_user['date'])}!", timestamp=datetime.utcnow(), color=0x800080).set_author( name=f"{message.author}", icon_url=f"{message.author.avatar_url}") await message.channel.send(embed=embed)
async def _modlogs(self, ctx, member: discord.Member): f""" {self.bot.command_prefix}{ctx.command.name} <member> """ _db = get_cluster(ctx.guild.id, "CLUSTER_WARN").find({"warned_user_id": member.id}) embed = discord.Embed(title="", description=f" ", timestamp=datetime.utcnow(), color=0xff0000).set_author( name=f"{member}'s' warns", icon_url=f"{member.avatar_url}") for i, warn in enumerate(_db): embed.add_field(name=f"Warn {i+1}: {warn['moderator_name']}", value=warn["warn_reason"], inline=False) await ctx.channel.send(embed=embed)
async def _pussy_size(self, ctx, member: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <user> """ if member == None: member = ctx.author _db = get_cluster(ctx.message.guild.id, "CLUSTER_GAY") _find_user = _db.find_one({"id": member.id}) if _find_user is None: size = random.randint(0, 100) new_pussy = ({"id": member.id, "pussy_size": size}) _db.insert(new_pussy) _find_user = _db.find_one({"id": member.id}) size = _find_user["pussy_size"] colour = 0xFFFFFF if size <= 20: status = random.choice(PUSSY_RESPONSE_DICT["PUSSY_SIZE_SMALL"]) elif 20 < size < 50: status = random.choice(PUSSY_RESPONSE_DICT["PUSSY_SIZE_MEDIUM"]) colour = 0xFFC0CB elif 50 < size < 66: status = random.choice(PUSSY_RESPONSE_DICT["PUSSY_SIZE_SMALL"]) colour = 0xFF69B4 else: status = random.choice(PUSSY_RESPONSE_DICT["PUSSY_SIZE_BUCKET"]) colour = 0xFF00FF embed = discord.Embed( description=f"Pussy Size for **{member }**", color=colour ).add_field(name="Pussy Size:", value=f"{status}").set_author( name="Pussy-Scannerâ„¢", icon_url= "https://assets.stickpng.com/images/580b585b2edbce24c47b2792.png") await ctx.send(embed=embed)
async def on_message(self, message): if isinstance(message.channel, discord.channel.DMChannel): return channel = self.bot.get_channel( get_channel_id(message.guild.id, "channel_general")) if channel != message.channel: return if not message.author.bot: _db = get_cluster(message.guild.id, "CLUSTER_EXPERIENCE") stats = _db.find_one({"id": message.author.id}) if stats is None: greenie = ({ "id": message.author.id, "xp": 5, }) _db.insert(greenie) else: xp = stats["xp"] + 5 lvl = 0 _db.update_one({"id": message.author.id}, {"$set": {"xp": xp}}) while True: if xp < ((50 * (lvl**2)) + (50 * (lvl - 1))): break lvl += 1 xp -= ((50 * ((lvl - 1)**2)) + (50 * (lvl - 1))) if xp == 0: embed = discord.Embed( description= f"{message.author.mention} Reached Level {lvl}!" ).set_image(url="https://i.imgur.com/qgpcufH.gif") await message.channel.send(embed=embed)
async def _afk(self, ctx, *, status="No status"): f""" {self.bot.command_prefix}{ctx.command.name} [afk message] """ await ctx.channel.trigger_typing() _db = get_cluster(ctx.message.guild.id, "CLUSTER_AFK") find_user = _db.find_one({"id": ctx.author.id}) if find_user is None: _db.insert({ "id": ctx.author.id, "status": status, "date": datetime.utcnow() }) embed = discord.Embed(description=f"**Status**: {status}", timestamp=datetime.utcnow(), color=0x800080).set_author( name=f"{ctx.author} is now afk!", icon_url=f"{ctx.author.avatar_url}") await ctx.channel.send(embed=embed)
async def _rank(self, ctx, member: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <member> """ await ctx.message.delete() if member is None: member = ctx.author _db = get_cluster(ctx.message.guild.id, "CLUSTER_EXPERIENCE") await ctx.channel.trigger_typing() stats = _db.find_one({"id": member.id}) if stats is None: raise NotInDatabase(member, "experience") xp = stats["xp"] lvl = get_level(xp) xp -= ((50 * ((lvl - 1)**2)) + (50 * (lvl - 1))) rank = get_rank(member, _db) try: colour = (stats["colour"][0], stats["colour"][1], stats["colour"][2]) except KeyError: colour = (65, 178, 138) try: background = (stats["background"]) except KeyError: background = "https://media.discordapp.net/attachments/665771066085474346/821993295310749716/statementofsolidarity.jpg?width=1617&height=910" create_rank_card(member, xp, lvl, rank, background, colour, ctx.guild.member_count) await ctx.send(file=discord.File( os.path.join(f"{IMAGE_PATH}//temp//", "card_temp.png")))
async def muted_members_check(self, ctx): await self.bot.wait_until_ready() time_now = datetime.utcnow() for guild_id, value in ALL_GUILD_DATABASES.items(): muted_collection = [db for db in value if db == "mute"] if muted_collection: _db = get_cluster(guild_id, "CLUSTER_MUTE") for muted_user in _db.find({}): if time_now > muted_user["end_date"]: member = discord.utils.get(self.bot.get_all_members(), id=muted_user["id"]) try: await self._unmute_user(member) _db.delete_many({'id': int(member.id)}) except (TypeError, AttributeError) as e: # Bot not initiated pass
async def _set_colour(self, ctx, r = None): f""" {self.bot.command_prefix}{ctx.command.name} <hex> """ _db = get_cluster(ctx.message.guild.id, "CLUSTER_EXPERIENCE") await ctx.message.delete() if r is None: raise MissingArgument("HEX", get_command_description(ctx.command.name)) r = r.lstrip('#') colour = ImageColor.getcolor(f"#{str(r).lower()}", "RGB") _db.update_one({"id": ctx.author.id}, {"$set":{"colour":colour}}) embed = discord.Embed( description=f"Your personal colour has been changed!", color=int(hex(int(r.replace("#", ""), 16)), 0) ) await ctx.send(embed=embed)
async def on_message_edit(self, before_edit, after_edit): log_channel = self.bot.get_channel(get_channel_id(before_edit.guild.id, "channel_logs")) if before_edit.content == after_edit.content: return if any(word in after_edit.content.lower() for word in get_cluster(before_edit.guild.id, "CLUSTER_BLACKLIST_WORDS").find_one({"id": "type_blacklist"})["array"]): await before_edit.delete() self.temp_message_edit_before = before_edit self.temp_message_edit_after = after_edit channel_id = before_edit.channel.id message_id = before_edit.id message_link = "https://discord.com/channels/787823476966162452" + f"/{channel_id}" + f"/{message_id}" embed=discord.Embed(title="", description=f"Message edited in: {before_edit.channel.mention}\n[Go To Message]({message_link})", timestamp=datetime.utcnow(), color=0x800080 ).set_author(name=f"{before_edit.author}", icon_url=f"{before_edit.author.avatar_url}" ).add_field(name="Before", value=f"{before_edit.content}", inline=False ).add_field(name="After", value=f"{after_edit.content}" ) await log_channel.send(embed=embed)
async def _mute(self, ctx, member: discord.Member = None, time="Indefinite", *, reason="None"): f""" {self.bot.command_prefix}{ctx.command.name} <member> <time> <reason> """ if member is None: raise MissingArgument("Discord User", get_command_description(ctx.command.name)) await ctx.message.delete() await ctx.channel.trigger_typing() _db = get_cluster(ctx.guild.id, "CLUSTER_MUTE") if time.isdigit(): time = f"{time}m" if time.isalpha(): reason = f"{time} {reason}" time = "Indefinite" if reason == "Indefinite None": reason = "None" if reason[-4:] == "None" and len(reason) != 4: reason = reason[:-4] await self._mute_user(ctx, member, time, reason) if time != 'Indefinite': await self._unmute_user(member) _db.delete_many({'id': member.id})
async def _purge(self, ctx, amount = None): f""" {self.bot.command_prefix}{ctx.command.name} <amount> """ await ctx.channel.trigger_typing() if amount is None: raise MissingArgument("Amount of messages", get_command_description(ctx.command.name)) try: amount = int(amount) except: raise ExpectedLiteralInt async for message in ctx.channel.history(limit=amount): if message.author == ctx.author: self.author_temp = message.author _db = get_cluster(ctx.message.guild.id, "CLUSTER_BLACKLIST_WORDS").find_one({"id": "type_blacklist"})["array"] if not message.content.startswith("?"): for word in _db: message.content = message.content.lower().replace(word, "[redacted]") deleted_messages.append(message) if deleted_messages: deleted_messages.reverse() await ctx.channel.purge(limit=amount + 1) embed=discord.Embed( description=f"Purged {amount} messages from {ctx.channel.mention}", timestamp=datetime.utcnow(), color=0xff0000 ).set_author(name=f"{ctx.author}", icon_url=f"{ctx.author.avatar_url}" ) await ctx.send(embed=embed)
async def on_message_delete(self, message): if message.content == "": return async for entry in message.guild.audit_logs(action=discord.AuditLogAction.message_delete, limit=1): now = datetime.utcnow() if now - timedelta(seconds=2) <= entry.created_at <= now+timedelta(seconds=2): self.deletee = entry.user else: self.deletee = message.author log_channel = self.bot.get_channel(get_channel_id(message.guild.id, "channel_logs")) if message.author.bot: return if str(self.author_temp) != str(message.author): deleted_messages.clear() self.author_temp = message.author if not message.content.startswith("?"): _db = get_cluster(message.guild.id, "CLUSTER_BLACKLIST_WORDS").find_one({"id": "type_blacklist"})["array"] for word in _db: message.content = message.content.lower().replace(word, "[redacted]") deleted_messages.append(message) embed=discord.Embed( description=f"Message deleted in: {message.channel.mention} by {self.deletee.mention}" if message.content[0:2] != "?m" else f"**Mirrored** message in: {message.channel.mention}", timestamp=datetime.utcnow(), color=0xff0000 ).set_author(name=f"{message.author}", icon_url=f"{message.author.avatar_url}" ).add_field(name="Content", value=f"{message.content}" ).add_field(name="ID", value=f"```ml\nUser = {message.author.id}\nMessage = {message.id}\n```", inline=False ) await log_channel.send(embed=embed)
async def on_member_join(self, member): _db = get_cluster(member.guild.id, "CLUSTER_SERVER_ROLES") for role_id in _db.find_one({"id": "type_on_join_roles"})["array"]: _ = discord.utils.get(member.guild.roles, id=role_id) await member.add_roles(_)
async def on_message(self, message): if any(word in message.content.lower() for word in get_cluster(message.guild.id, "CLUSTER_BLACKLIST_WORDS").find_one({"id": "type_blacklist"})["array"]): await message.delete()
async def _ship(self, ctx, member: discord.Member = None, member2: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <user_1> <user_2> """ if member is None or member2 is None: raise MissingArgument("@user", get_command_description(ctx.command.name)) members = [member.id, member2.id] members.sort() _db = get_cluster(ctx.message.guild.id, "CLUSTER_SHIP") _find_user = _db.find_one({ "member_one": members[0], "member_two": members[1] }) if _find_user is None: shipnumber = random.randint(0, 100) new_ship = ({ "member_one": members[0], "member_two": members[1], "rating": shipnumber }) _db.insert(new_ship) _find_user = _db.find_one({ "member_one": members[0], "member_two": members[1] }) shipnumber = _find_user["rating"] if 0 <= shipnumber <= 10: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_REALLY_LOW"]) status = f"Really low! {choice}" elif 10 < shipnumber <= 20: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_LOW"]) status = f"Low! {choice}" elif 20 < shipnumber <= 30: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_POOR"]) status = f"Poor! {choice}" elif 30 < shipnumber <= 40: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_FAIR"]) status = f"Fair! {choice}" elif 40 < shipnumber <= 60: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_MODERATE"]) status = f"Moderate! {choice}" elif 60 < shipnumber <= 70: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_GOOD"]) status = f"Good! {choice}" elif 70 < shipnumber <= 80: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_GREAT"]) status = f"Great! {choice}" elif 80 < shipnumber <= 90: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_OVERAVERAGE"]) status = f"Over Average! {choice}" elif 90 < shipnumber <= 100: choice = random.choice(SHIP_RESPONSE_DICT["SHIP_TRUELOVE"]) status = f"True Love! {choice}" if shipnumber <= 33: colour = 0xE80303 elif 33 < shipnumber < 66: colour = 0xff6600 else: colour = 0x3be801 embed = (discord.Embed( color=colour, title="Simp rate for:", description= f"**{member}** and **{member2}** {random.choice(HEART_RESPONSE_LIST)}" )).add_field( name="Results:", value=f"{shipnumber}%", inline=True ).add_field(name="Status:", value=(status), inline=False).set_author( name="Shipping", icon_url="http://moziru.com/images/kopel-clipart-heart-6.png") await ctx.send(embed=embed)