async def _eightball(self, ctx, *, _ballInput=None): f""" {self.bot.command_prefix}{ctx.command.name} <question> """ if _ballInput is None: raise MissingArgument("Question", get_command_description(ctx.command.name)) choice = random.randint(1, 3) if choice == 1: prediction = random.choice( EIGHT_BALL_RESPONSE_DICT["EIGHT_BALL_AFFIRMATIVE"]) colour = 0x3be801 elif choice == 2: prediction = random.choice( EIGHT_BALL_RESPONSE_DICT["EIGHT_BALL_UNSURE"]) colour = 0xff6600 elif choice == 3: prediction = random.choice( EIGHT_BALL_RESPONSE_DICT["EIGHT_BALL_NEGATIVE"]) colour = 0xE80303 embed = discord.Embed( title=f"Question: {_ballInput}", description=f"{prediction} :8ball:", colour=colour ).set_author( name='Magic 8 ball', icon_url= 'https://www.horoscope.com/images-US/games/game-magic-8-ball-no-text.png' ) await ctx.send(embed=embed)
async def _ban(self, ctx, member: discord.Member = None, *, reason=None): f""" {self.bot.command_prefix}{ctx.command.name} <member> <reason> """ if member is None: raise MissingArgument("Discord User", get_command_description(ctx.command.name)) try: await member.ban(reason=reason) except: raise MissingPermissionOnMember("ban", member) await ctx.message.delete() await ctx.channel.trigger_typing() log_channel = self.bot.get_channel( get_channel_id(member.guild.id, "channel_logs")) embed = discord.Embed( description=f" ", timestamp=datetime.utcnow(), color=0xff0000).set_author( name=f"{ctx.author} banned member", icon_url=f"{ctx.author.avatar_url}").add_field( name="User", value=f"{member.mention}").add_field( name="Punishment", value=f"Banned").add_field(name="Reason", value=f"{reason}") await log_channel.send(embed=embed) await member.send(embed=embed) await member.send( "https://cdn.discordapp.com/attachments/811885989005492276/812847731461849108/y2mate.com_-_ARSENAL_FAN_TV_ITS_TIME_TO_GO_MEME_360p_1.mp4" )
async def _kick(self, ctx, member: discord.Member = None, *, reason=None): f""" {self.bot.command_prefix}{ctx.command.name} <member> <reason> """ if member is None: raise MissingArgument("Discord User", get_command_description(ctx.command.name)) try: await member.kick(reason=reason) except: raise MissingPermissionOnMember("kick", member) await ctx.message.delete() await ctx.channel.trigger_typing() log_channel = self.bot.get_channel( get_channel_id(member.guild.id, "channel_logs")) embed = discord.Embed( title="", description=f" ", timestamp=datetime.utcnow(), color=0xff0000).set_author( name=f"{ctx.author} kicked member", icon_url=f"{ctx.author.avatar_url}").add_field( name="User", value=f"{member.mention}").add_field( name="Punishment", value=f"Kicked").add_field(name="Reason", value=f"{reason}") await log_channel.send(embed=embed) await member.send(embed=embed)
async def _kiss(self, ctx, member: discord.Member = None): f""" {self.bot.command_prefix}{ctx.command.name} <user> """ if member is None: raise MissingArgument("Discord Member", get_command_description(ctx.command.name)) embed = discord.Embed( description= f"{ctx.message.author.mention} Kissed {member.mention}, How Sweet {random.choice(HEART_RESPONSE_LIST)}", color=0xc81f9f, ).set_image(url=f"{random.choice(KISS_GIF_ARRAY)}") await ctx.send(embed=embed)
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 _clear(self, ctx, member: discord.Member = None, limit: int = None): f""" {self.bot.command_prefix}{ctx.command.name} <member> <amount to delete> """ if member is None: raise MissingArgument("Discord User", get_command_description(ctx.command.name)) await ctx.channel.trigger_typing() channel_arr = [channel for channel in ctx.guild.text_channels] for channel in channel_arr: async for message in channel.history(limit=limit): if message.author == member: try: await message.delete() except: 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 _defchannel(self, ctx, channel=None, new_channel: discord.TextChannel = None): """ ?defchannel [old-channel] #[new-channel] """ if channel is None: raise MissingArgument("Channel ID", get_command_description(ctx.command.name)) CLUSTER_UTIL = self.bot.mongo_client[str( ctx.message.guild.id)]["utils"] CLUSTER_UTIL.update( {"id": "type_important_channels"}, {"$set": { f"dict.channel_{channel}": new_channel.id }}) embed = embed_success( f"Changed `{channel}` channel to {new_channel.mention}") await ctx.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 _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)