Example #1
0
 async def cmd_ban(self, ctx, *, arg=""):
     if not perms.get_perms(ctx.message).ban_members and not perms.is_lmao_admin(ctx.message):
         await ctx.send(f"{ctx.author.mention} You do not have the permission to ban members.")
         usage.update(ctx)
         return ctx.command.name
     try:
         if len(ctx.message.mentions) == 1:
             to_ban = ctx.message.mentions[0]
             if to_ban == self.bot.user:
                 await ctx.send(f"Silly {ctx.author.mention}, I can't ban myself!")
             elif to_ban.id == 210220782012334081:
                 await ctx.send(f"Please, {ctx.author.mention}, you can't ban my creator.")
             elif to_ban.id == ctx.author.id:
                 await ctx.send(f"{ctx.author.mention}, you can't ban yourself.")
             else:
                 reason = arg.replace(to_ban.mention, "").strip()
                 reason_message = f"Reason: {reason}"
                 if reason == "":
                     reason_message = "No reason given."
                 e = discord.Embed(title=f"You have been banned from {ctx.guild.name} by {ctx.author}", description=reason_message, timestamp=datetime.now())
                 await to_ban.send(embed=e)
                 await to_ban.ban(reason=reason)
                 await ctx.send(f"Goodbye, {to_ban}, I'll see you in therapy! (Or never, 'cause, you know, you're banned...)")
         elif len(ctx.message.mentions) < 1:
             await ctx.send(f"{ctx.author.mention} You must mention the user you want to ban from the guild.")
         elif len(ctx.message.mentions) > 1:
             await ctx.send(f"{ctx.author.mention} You may not ban more than one member at a time.")
     except discord.errors.Forbidden:
         await ctx.send(f"{ctx.author.mention} lmao-bot eithers lacks the permission to ban members or the member you tried to ban is of an equal or higher role than lmao-bot. Make sure `Ban Members` is enabled for lmao-bot and that lmao-bot is a higher role than the member you are trying to ban.")
     usage.update(ctx)
     return ctx.command.name
Example #2
0
 async def cmd_toggle_nsfw(self, ctx):
     if not perms.get_perms(
             ctx.message).manage_messages and not perms.is_lmao_admin(
                 ctx.message):
         await ctx.send(
             f"{ctx.author.mention} You do not have the permission to toggle NSFW settings for your guild."
         )
         usage.update(ctx)
         return ctx.command.name
     if ctx.invoked_with == "nsfwon":
         allow_nsfw = lbvars.set_allow_nsfw(ctx.guild.id, True)
     elif ctx.invoked_with == "nsfwoff":
         allow_nsfw = lbvars.set_allow_nsfw(ctx.guild.id, False)
     else:
         allow_nsfw = lbvars.toggle_allow_nsfw(ctx.guild.id)
     if (allow_nsfw):
         await ctx.send(
             f":smirk: What's wrong, big boy? Never had your server filled with p**n by a bot before?\n\n(NSFW commands enabled for {ctx.guild.name})"
         )
     else:
         await ctx.send(
             ":angel: No NSFW content is allowed on this Christian Discord server."
         )
     usage.update(ctx)
     return ctx.command.name
Example #3
0
 async def cmd_add_admin(self, ctx, *, arg=""):
     if perms.is_lmao_admin(ctx.message):
         if len(ctx.message.mentions) == 1:
             if str(ctx.message.mentions[0].id) in lbvars.get_lmao_admin_list(ctx.guild.id):
                 await ctx.send(ctx.message.mentions[0].name + " is already a lmao administrator.")
             else:
                 lbvars.add_lmao_admin(ctx.guild.id, ctx.message.mentions[0].id)
                 await ctx.send(ctx.message.mentions[0].mention + " has been added as a lmao administrator for this guild.")
         elif len(ctx.message.mentions) > 1:
             await ctx.send(f"{ctx.author.mention} You may only add one lmao administrator at a time.")
         elif len(ctx.message.mentions) < 1:
             await ctx.send(f"{ctx.author.mention} You must mention the user you want to add as a lmao administrator.")
     else:
         await ctx.send(f"{ctx.author.mention} Only guild administrators and lmao administrators can add other lmao administrators.")
     usage.update(ctx)
     return ctx.command.name
Example #4
0
 async def cmd_unmute(self, ctx, *, arg=""):
     if perms.get_perms(ctx.message).manage_channels or perms.is_lmao_admin(ctx.message):
         try:
             if len(ctx.message.mentions) == 1:
                 unmuted_perms = ctx.channel.overwrites_for(ctx.message.mentions[0])
                 unmuted_perms.send_messages = None
                 await ctx.channel.set_permissions(ctx.message.mentions[0], overwrite=unmuted_perms)
                 await ctx.send(f"{ctx.message.mentions[0].mention} was unmuted in {ctx.channel.mention} by {ctx.author.mention}.")
             elif len(ctx.message.mentions) < 1:
                 await ctx.send(f"{ctx.author.mention} You must mention the user you want to unmute on this channel.")
             elif len(ctx.message.mentions) > 1:
                 await ctx.send(f"{ctx.author.mention} You may not unmute more than one member at a time.")
         except discord.errors.Forbidden:
             await ctx.send(f"{ctx.author.mention} lmao-bot eithers lacks the permission to unmute members or the member you tried to unmute is of an equal or higher role than lmao-bot. Make sure `Manage Channels` is enabled for lmao-bot and that lmao-bot is a higher role than the member you are trying to unmute.")
     else:
         await ctx.send(f"{ctx.author.mention} You do not have the permission to unmute members.")
     usage.update(ctx)
     return ctx.command.name
Example #5
0
 async def cmd_mute(self, ctx, *, arg=""):
     #muted_perms = discord.Permissions(send_messages=False)
     #lmao_muted = await ctx.guild.create_role(name="lmao muted", permissions=muted_perms)
     if perms.get_perms(ctx.message).manage_channels or perms.is_lmao_admin(ctx.message):
         try:
             if len(ctx.message.mentions) == 1:
                 if ctx.message.mentions[0] == self.bot.user:
                     await ctx.send(f"Silly {ctx.author.mention}, I can't mute myself!")
                 elif ctx.message.mentions[0].id == 210220782012334081:
                     await ctx.send(f"Please, {ctx.author.mention}, you can't mute my creator.")
                 else:
                     mute_time = 0
                     if arg.find(" ") != -1:
                         try:
                             mute_time = int(arg[:arg.find(" ")])
                             if mute_time <= 0:
                                 mute_time = 0
                         except ValueError:
                             mute_time = 0
                     muted_perms = ctx.channel.overwrites_for(ctx.message.mentions[0])
                     muted_perms.send_messages = False
                     await ctx.channel.set_permissions(ctx.message.mentions[0], overwrite=muted_perms)
                     #await ctx.message.mentions[0].add_roles(lmao_muted)
                     after_msg = ""
                     if mute_time != 0:
                         after_msg += f" for {mute_time} minutes"
                     after_msg += "."
                     await ctx.send(f"{ctx.message.mentions[0].mention} was muted in {ctx.channel.mention} by {ctx.author.mention}{after_msg}")
                     if mute_time != 0:
                         await asyncio.sleep(mute_time * 60)
                         muted_perms = ctx.channel.overwrites_for(ctx.message.mentions[0])
                         muted_perms.send_messages = None
                         await ctx.channel.set_permissions(ctx.message.mentions[0], overwrite=muted_perms)
             elif len(ctx.message.mentions) < 1:
                 await ctx.send(f"{ctx.author.mention} You must mention the user you want to mute on this channel.")
             elif len(ctx.message.mentions) > 1:
                 await ctx.send(f"{ctx.author.mention} You may not mute more than one member at a time.")
         except discord.errors.Forbidden:
             await ctx.send(f"{ctx.author.mention} lmao-bot eithers lacks the permission to mute members or the member you tried to mute is of an equal or higher role than lmao-bot. Make sure `Manage Channels` is enabled for lmao-bot and that lmao-bot is a higher role than the member you are trying to mute.")
     else:
         await ctx.send(f"{ctx.author.mention} You do not have the permission to mute members.")
     usage.update(ctx)
     return ctx.command.name
Example #6
0
 async def cmd_purge(self, ctx, *, arg=""):  # Allows the deletion of messages
     if perms.get_perms(ctx.message).manage_messages or perms.is_lmao_admin(ctx.message):
         try:
             if int(arg) > 100:
                 await ctx.send("You cannot delete more than 100 messages.")
             elif int(arg) > 0:
                 deleted = await ctx.channel.purge(limit=int(arg) + 1)
                 deleted_message = await ctx.send(f"**Successfully deleted {len(deleted) - 1} message(s).**", delete_after=3)
             elif int(arg) == 0:
                 await ctx.send(f"{ctx.author.mention} I'm always deleting 0 messages. You don't need to call a command for that.")
             else:
                 await ctx.send(f"{ctx.author.mention} What, you think I'm some sort of magician who can delete a negative number of messages?")
         except ValueError:
             await ctx.send(f"{ctx.author.mention} You must specify the number of messages to purge. e.g. `{ctx.prefix}purge 5`")
         except discord.errors.Forbidden:
             await ctx.send(f"{ctx.author.mention} The messages could not be purged due to insufficient permissions for lmao-bot. Make sure `Manage Messages` is enabled for lmao-bot.")
     else:
         await ctx.send(f"{ctx.author.mention} You do not have the permission to manage messages.")
     usage.update(ctx)
     return ctx.command.name
Example #7
0
    async def cmd_react(self, ctx, arg=""):
        guild_id = ctx.guild.id
        if perms.is_lmao_admin(ctx.message) or perms.get_perms(
                ctx.message).manage_messages:
            new_chance = arg
            if new_chance == "":
                await ctx.send(
                    f"{ctx.author.mention} My current reaction chance for {ctx.guild.name} is `{lbvars.get_react_chance(guild_id)}%`. What should I change it to?\n\n(Note: Say `cancel` to cancel this change.)"
                )

                def check(message):
                    return message.author == ctx.author and message.channel == ctx.channel

                try:
                    message = await self.bot.wait_for("message",
                                                      timeout=30.0,
                                                      check=check)
                    if message.content.lower() == "cancel":
                        await ctx.send(
                            f":x: {ctx.author.mention} Reaction chance change cancelled."
                        )
                        usage.update(ctx)
                        return ctx.command.name
                    new_chance = message.content
                except asyncio.TimeoutError:
                    await ctx.send(
                        f":x: {ctx.author.mention} Command timed out.")
                    usage.update(ctx)
                    return ctx.command.name
            valid_chance = True
            chance = lbvars.get_react_chance(guild_id)
            try:
                chance = int(new_chance.replace("%", ""))
                if chance < 0 or chance > 100:
                    valid_chance = False
            except ValueError:
                if new_chance == "off":
                    chance = 0
                elif new_chance == "on":
                    chance = 100
                else:
                    valid_chance = False
            if valid_chance:
                after_msg = ""
                if chance == 0:
                    after_msg = "Looks like the Fine Bros found us. :pensive:"
                else:
                    after_msg = "Watch out for the Fine Bros. :eyes:"
                lbvars.set_react_chance(guild_id, chance)
                await ctx.send(
                    f"You have changed the automatic emoji reaction chance for {ctx.guild.name} to `{chance}%`. {after_msg}"
                )
            else:
                await ctx.send(
                    r'You must include an integer after `react` from 0 to 100. This is the chance (in %) of automatic emoji reactions.'
                )
        else:
            await ctx.send(
                ctx.author.mention +
                " You do not have the permission to change the reaction chance. Ask a guild administrator, lmao administrator, or user with the `Manage Messages` permission to do so."
            )
        usage.update(ctx)
        return ctx.command.name
Example #8
0
    async def cmd_toggle(
            self,
            ctx,
            arg=""
    ):  # Toggle whether automatic ass substitution happens or not
        guild_id = ctx.guild.id
        if perms.is_lmao_admin(ctx.message) or perms.get_perms(
                ctx.message).manage_messages:
            valid_shortcuts = ["on", "off", "lotto"]
            new_chance = arg
            if new_chance == "" and ctx.invoked_with not in valid_shortcuts:
                await ctx.send(
                    f"{ctx.author.mention} My current ass replacement chance for {ctx.guild.name} is `{lbvars.get_replace_ass_chance(guild_id)}%`. What should I change it to?\n\n(Note: Say `cancel` to cancel this change.)"
                )

                def check(message):
                    return message.author == ctx.author and message.channel == ctx.channel

                try:
                    message = await self.bot.wait_for("message",
                                                      timeout=30.0,
                                                      check=check)
                    if message.content.lower() == "cancel":
                        await ctx.send(
                            f":x: {ctx.author.mention} Ass replacement chance change cancelled."
                        )
                        usage.update(ctx)
                        return ctx.command.name
                    new_chance = message.content
                except asyncio.TimeoutError:
                    await ctx.send(
                        f":x: {ctx.author.mention} Command timed out.")
                    usage.update(ctx)
                    return ctx.command.name
            valid_chance = True
            chance = lbvars.get_replace_ass_chance(guild_id)
            try:
                chance = int(new_chance.replace("%", ""))
                if chance < 0 or chance > 100:
                    valid_chance = False
            except ValueError:
                if new_chance == "off" or ctx.invoked_with == "off":
                    chance = 0
                elif new_chance == "on" or ctx.invoked_with == "on":
                    chance = 100
                elif new_chance == "lotto" or ctx.invoked_with == "lotto":
                    chance = 1
                else:
                    valid_chance = False
            if valid_chance:
                after_msg = ""
                if chance <= 50:
                    after_msg = "Tread carefully, and hold onto your buns."
                else:
                    after_msg = "Don't do anything reckless; you'll be fine."
                lbvars.set_replace_ass_chance(guild_id, chance)
                await ctx.send(
                    f"You have changed the automatic ass replacement chance for {ctx.guild.name} to `{chance}%`. {after_msg}"
                )
            else:
                await ctx.send(
                    f"{ctx.author.mention} You must include an integer after toggleass from 0 to 100. This is the chance (in %) of automatic ass replacement."
                )
        else:
            await ctx.send(
                ctx.author.mention +
                " You do not have the permission to change the ass replacement chance. Ask a guild administrator, lmao administrator, or user with the `Manage Messages` permission to do so."
            )
        usage.update(ctx)
        return ctx.command.name