Exemple #1
0
 async def cmd_8ball(self, ctx):
     responses = ["It is certain.",
                  "It is decidedly so.",
                  "Without a doubt.",
                  "Yes - definitely.",
                  "You may rely on it.",
                  "As I see it, yes.",
                  "Most likely.",
                  "Outlook good.",
                  "Yes.",
                  "Signs point to yes.",
                  "Reply hazy, try again.",
                  "Ask again later.",
                  "Better not tell you now.",
                  "Cannot predict now.",
                  "Concentrate and ask again.",
                  "Don't count on it.",
                  "My reply is no.",
                  "My sources say no.",
                  "Outlook not so good.",
                  "Very doubtful."]
     roll = random.randint(0,19)
     emoji = ":negative_squared_cross_mark:"
     if roll < 10:
         emoji = ":white_check_mark:"
     elif roll < 15:
         emoji = ":question:"
     await ctx.send(emoji + " " + ctx.author.mention + " " + responses[roll])
     usage.update(ctx)
     return ctx.command.name
Exemple #2
0
 async def cmd_ping(self, ctx):  # Ping-Pong
     pong_title = "🏓 Pong!"
     pong_desc = f"Latency: {round(self.bot.latency * 1000, 2)} ms"
     await ctx.send(
         embed=discord.Embed(title=pong_title, description=pong_desc))
     usage.update(ctx)
     return ctx.command.name
Exemple #3
0
 async def cmd_dice(self, ctx, *, arg=""):
     emoji = ["one",
              "two",
              "three",
              "four",
              "five",
              "six"]
     try:
         if int(arg) > 100:
             await ctx.send("You may only roll up to 100 dice at a time.")
             return 'dice'
         elif int(arg) > 0:
             dice_number = int(arg)
         else:
             dice_number = 1
     except ValueError:
         dice_number = 1
     dice_msg = ctx.author.mention + " :game_die: You just rolled a "
     dice_emoji = ""
     total = 0
     for roll_x in range(dice_number):
         die = random.randint(1,6)
         dice_msg += "**" + str(die) + "** + "
         dice_emoji += ":" + emoji[die-1] + ":"
         total += die
     dice_msg = dice_msg[:-3] + "! "
     await ctx.send(dice_msg + dice_emoji)
     if dice_number > 1:
         dice_stats = "`Total:   " + str(total) + "`\n`Average: " + str(total / dice_number) + "`"
         await ctx.send(dice_stats)
     usage.update(ctx)
     return ctx.command.name
Exemple #4
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
Exemple #5
0
 async def cmd_info(self, ctx):  # Returns about lmao-bot message
     desc = """I am a fun utility bot created by Firestar493#6963 and DrEngineer#8214 with discord.py in June 2018. I replace people's asses after they \"lmao\" or \"lmfao\". Try it out!\n
     I do all sorts of other things too, such as play music, provide moderation commands, and give answers from the almighty magic 8-ball. Invite me to one of your servers to see for yourself!"""
     e = discord.Embed(title="Hello from lmao-bot! 👋",
                       color=lbvars.LMAO_ORANGE,
                       description=desc)
     e.set_thumbnail(url=self.bot.user.avatar_url)
     e.add_field(name="Server Count", value=len(self.bot.guilds))
     e.add_field(name="Total Member Count",
                 value=usage.count_total_members(self.bot))
     e.add_field(name="Shard Count", value=len(self.bot.shards))
     e.add_field(
         name="Invite me to your server",
         value=
         "[You won't regret it 👀](https://discordapp.com/oauth2/authorize?client_id=459432854821142529&scope=bot&permissions=336063575)"
     )
     e.add_field(name="Join the support server",
                 value="[Send help pls](https://discord.gg/JQgB7p7)")
     e.add_field(
         name="Vote for me on Discord Bot List",
         value=
         "[The power is in your hands](https://discordbots.org/bot/459432854821142529/vote)"
     )
     e.set_footer(text="Try saying \"lmao help\" in a server I'm in!",
                  icon_url=self.bot.user.avatar_url)
     await ctx.send(embed=e)
     usage.update(ctx)
     return ctx.command.name
Exemple #6
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
Exemple #7
0
 async def cmd_gone_wild(self, ctx):
     sub = ctx.invoked_with
     if sub == "gonewildmale":
         sub = "ladybonersgw"
     await ctx.channel.trigger_typing()
     if sub not in self.reddit_posts:
         await self.init_reddit_posts(sub)
     if await self.check_voted(ctx):
         while True:
             post = random.choice(self.reddit_posts[sub])["data"]
             title = html.unescape(post["title"])
             permalink = f"https://www.reddit.com{post['permalink']}"
             e = discord.Embed(title=title, url=permalink)
             try:
                 if post["post_hint"] == "image":
                     e.set_image(url=post["url"])
                 elif post["post_hint"] == "rich:video":
                     desc = f"_Psst_, I'm a video--[click my link!]({post['url']})"
                     e = discord.Embed(title=title, description=desc)
                     e.set_image(url=post["thumbnail"])
                 else:
                     continue
                 footer = f"Posted by {html.unescape(post['author'])} on /r/{sub}"
                 e.set_footer(text=footer)
                 break
             except KeyError:
                 pass
         await ctx.send(embed=e)
     usage.update(ctx)
     return ctx.command.name
Exemple #8
0
 async def replace_ass(self, ctx):    # Sends the ass substitution message
     with io.open("../data/user_data.json") as f:
         lmao_count_data = json.load(f)
         try:
             lmao_count_data[str(ctx.author.id)]["lmao_count"] += 1
         except KeyError:
             lmao_count_data[str(ctx.author.id)] = {"lmao_count": 1}
         lmao_count_data[str(ctx.author.id)]["username"] = str(ctx.author)
         new_user_data = json.dumps(lmao_count_data, indent=4)
         with io.open("../data/user_data.json", "w+", encoding="utf-8") as fo:
             fo.write(new_user_data)
     x = random.randint(1, 100)
     if ctx.guild is None or x <= lbvars.get_react_chance(ctx.guild.id):
         try:
             await ctx.message.add_reaction('�')
         except discord.errors.Forbidden:
             pass
     y = random.randint(1, 100)
     if ctx.guild is None or y <= lbvars.get_replace_ass_chance(ctx.guild.id):
         try:
             await ctx.send(f"{ctx.author.mention} {lbvars.replace_ass_msg}")
         except discord.errors.Forbidden:
             pass
     usage.update(ctx)
     return ctx.command.name
Exemple #9
0
 async def cmd_change_maintenance(self, ctx, *, arg=""):
     lbvars.set_maintenance_time(arg)
     await self.bot.change_presence(activity=discord.Game(
         name=f"lmao help | Maint.: {lbvars.maintenance_time}"))
     lbvars.custom_game = True
     usage.update(ctx)
     return ctx.command.name
Exemple #10
0
 async def cmd_card(self, ctx, *, arg=""):
     try:
         if int(arg) > 52:
             await ctx.send("You may only draw up to 52 cards.")
             return 'card'
         elif int(arg) > 0:
             card_number = int(arg)
         else:
             card_number = 1
     except ValueError:
         card_number = 1
     card_msg = ctx.author.mention + " :black_joker: You just drew "
     drawn = []
     rank = random.randint(1,13)
     suit = random.randint(1,4)
     for card_x in range(card_number):
         while [rank, suit] in drawn:
             rank = random.randint(1,13)
             suit = random.randint(1,4)
         card_msg += ranks[rank - 1] + suits[suit - 1] + " + "
         drawn.append([rank, suit])
     card_msg = card_msg[:-3] + "! "
     await ctx.send(card_msg)
     usage.update(ctx)
     return ctx.command.name
Exemple #11
0
 async def cmd_reminders(self, ctx):
     with io.open("../data/reminders.json") as f:
         reminders = json.load(f)["reminders"]
         my_reminders = []
         for reminder in reminders:
             if reminder["author"] == ctx.author.id:
                 my_reminders.append(reminder)
         if len(my_reminders) == 0:
             await ctx.send(
                 f"{ctx.author.mention} You currently have no reminders set. Use `{ctx.prefix}remind` to set one, you forgetful bum."
             )
             usage.update(ctx)
             return ctx.command.name
         embeds = [discord.Embed(title=f"🎗️ Reminders for {ctx.author}")]
         count = 0
         for reminder in my_reminders:
             if count >= 25:
                 embeds.append(
                     discord.Embed(title=f"🎗️ Reminders for {ctx.author}"))
                 count = 0
             embeds[len(embeds) - 1].add_field(
                 name=f"Reminder for {reminder['set_for']}",
                 value=reminder["message"])
             count += 1
         for i in range(0, len(embeds)):
             embeds[i].set_footer(text=f"Page {i + 1}")
         for e in embeds:
             await ctx.send(embed=e)
         usage.update(ctx)
         return ctx.command.name
Exemple #12
0
 async def cmd_chance(self, ctx):
     guild_id = ctx.guild.id
     e = discord.Embed(title=f"{ctx.guild.name} Chance Settings")
     e.add_field(name="Ass replacement",
                 value=f"{lbvars.get_replace_ass_chance(guild_id)}%")
     e.add_field(name="Ass reaction",
                 value=f"{lbvars.get_react_chance(guild_id)}%")
     await ctx.send(embed=e)
     usage.update(ctx)
     return ctx.command.name
Exemple #13
0
 async def cmd_get_emoji(self, ctx, *, arg=""):
     emoji = lbutil.get_emoji(arg)
     if emoji is not None:
         id = lbutil.get_emoji_id(arg)
         await ctx.message.add_reaction(self.bot.get_emoji(id))
         await ctx.send(emoji)
     else:
         await ctx.send(f"Emoji {arg} not found.")
     usage.update(ctx)
     return ctx.command.name
Exemple #14
0
 async def cmd_vote(self, ctx):
     vote_link = "https://discordbots.org/bot/459432854821142529/vote"
     desc = f"Like lmao-bot?\n\n[**Vote** for lmao-bot on Discord Bot List!]({vote_link})"
     e = discord.Embed(title="Vote for lmao-bot!",
                       color=lbvars.LMAO_ORANGE,
                       description=desc)
     e.set_thumbnail(url=self.bot.user.avatar_url)
     await ctx.send(embed=e)
     usage.update(ctx)
     return ctx.command.name
Exemple #15
0
 async def cmd_invite(self, ctx):
     invite_link = "https://discordapp.com/oauth2/authorize?client_id=459432854821142529&scope=bot&permissions=336063575"
     desc = f"Need ass insurance on other servers you're in?\n\n[Click here to invite me to more servers!]({invite_link})"
     e = discord.Embed(title="Invite lmao-bot!",
                       color=lbvars.LMAO_ORANGE,
                       description=desc)
     e.set_thumbnail(url=self.bot.user.avatar_url)
     await ctx.send(embed=e)
     usage.update(ctx)
     return ctx.command.name
Exemple #16
0
 async def cmd_avatar(self, ctx):
     member = ctx.author
     if len(ctx.message.mentions) > 0:
         member = ctx.message.mentions[0]
     path = f"../img/avatar_{member.id}"
     path = fun.save_avatar(member, path)
     await ctx.send(file=discord.File(path))
     os.remove(path)
     usage.update(ctx)
     return ctx.command.name
Exemple #17
0
 async def cmd_uptime(self, ctx):
     current_time = time.time()
     with io.open("../management/next_maintenance.txt") as f:
         next_maintenance = f.read().strip()
     e = discord.Embed(color=lbvars.LMAO_ORANGE)
     e.add_field(name="lmao-bot Uptime",
                 value=lbutil.eng_time(current_time - lbvars.start_time))
     e.add_field(name="Next Maintenance Break", value=next_maintenance)
     await ctx.send(embed=e)
     usage.update(ctx)
     return ctx.command.name
Exemple #18
0
 async def cmd_garbage(self, ctx):
     await ctx.trigger_typing()
     try:
         garbage_person = ctx.message.mentions[0]
     except IndexError:
         garbage_person = ctx.author
     await garbage(garbage_person)
     img_file = f"../img/garbage_{garbage_person.id}.png"
     await ctx.send(f"{garbage_person.mention} is GARBAGE! :wastebasket:",
                    file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #19
0
 async def cmd_triggered(self, ctx):
     await ctx.trigger_typing()
     try:
         triggered_person = ctx.message.mentions[0]
     except IndexError:
         triggered_person = ctx.author
     await triggered(triggered_person)
     img_file = f"../img/triggered_{triggered_person.id}.png"
     await ctx.send(f"{triggered_person.mention} needs a safe space!",
                    file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #20
0
 async def cmd_victory(self, ctx):
     await ctx.trigger_typing()
     try:
         victory_person = ctx.message.mentions[0]
     except IndexError:
         victory_person = ctx.author
     await victory(victory_person)
     img_file = f"../img/victory_{victory_person.id}.png"
     await ctx.send(f"{victory_person.mention} :trophy: Victory Royale!",
                    file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #21
0
 async def cmd_beautiful(self, ctx):
     await ctx.trigger_typing()
     try:
         beautiful_person = ctx.message.mentions[0]
     except IndexError:
         beautiful_person = ctx.author
     await beautiful(beautiful_person)
     img_file = "../img/beautiful_{}.png".format(beautiful_person.id)
     await ctx.send(f"{beautiful_person.mention} :heart:",
                    file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #22
0
 async def cmd_ugly(self, ctx):
     await ctx.trigger_typing()
     try:
         ugly_person = ctx.message.mentions[0]
     except IndexError:
         ugly_person = ctx.author
     await ugly(ugly_person)
     img_file = f"../img/ugly_{ugly_person.id}.png"
     await ctx.send(f"{ugly_person.mention} :japanese_goblin:",
                    file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #23
0
 async def cmd_wanted(self, ctx):
     await ctx.trigger_typing()
     try:
         wanted_person = ctx.message.mentions[0]
     except IndexError:
         wanted_person = ctx.author
     await wanted(wanted_person)
     img_file = f"../img/wanted_{wanted_person.id}.png"
     await ctx.send(f"{wanted_person.mention} is WANTED!",
                    file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #24
0
 async def cmd_deepfry(self, ctx):
     await ctx.trigger_typing()
     fp = await save_file_from_ctx(ctx,
                                   f"../img/deepfry_{ctx.message.id}.jpg")
     try:
         img = Image.open(fp)
     except OSError:
         img = get_avatar(ctx.author)
     fried = await deeppyer.deepfry(img)
     fried.save(fp)
     await ctx.send(file=discord.File(fp))
     os.remove(fp)
     usage.update(ctx)
     return ctx.command.name
Exemple #25
0
 async def cmd_seen_from_above(self, ctx):
     await ctx.trigger_typing()
     try:
         seen_from_above_person = ctx.message.mentions[0]
     except IndexError:
         seen_from_above_person = ctx.author
     await seen_from_above(seen_from_above_person)
     img_file = f"../img/seen_from_above_{seen_from_above_person.id}.png"
     await ctx.send(
         f"It's... {seen_from_above_person.mention}, seen from above!",
         file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #26
0
 async def cmd_whos_that(self, ctx):
     await ctx.trigger_typing()
     try:
         whos_that_person = ctx.message.mentions[0]
     except IndexError:
         whos_that_person = ctx.author
     await whos_that(whos_that_person)
     img_file = f"../img/whos_that_{whos_that_person.id}.png"
     await ctx.send(
         f"Who's that Pokémon?\n\nIt's... {whos_that_person.mention}!",
         file=discord.File(img_file))
     os.remove(img_file)
     usage.update(ctx)
     return ctx.command.name
Exemple #27
0
 async def cmd_add_emoji(self, ctx, *, arg=""):
     with io.open("../data/emojis.json") as f:
         emojis = json.load(f)
     colon1 = arg.find(":")
     colon2 = colon1 + arg[colon1 + 1:].find(":") + 1
     if colon1 == -1 or colon2 == -1:
         await ctx.send(f"{arg} is an invalid emoji.")
         usage.update(ctx)
         return ctx.command.name
     name = arg[colon1 + 1:colon2].strip()
     emojis[name] = arg
     new_emojis = json.dumps(emojis, indent=4)
     with io.open("../data/emojis.json", "w+") as f:
         f.write(new_emojis)
     await ctx.send(f":white_check_mark: `{name}` added as an emoji. {arg}")
Exemple #28
0
 async def cmd_remove_admin(self, ctx, *, arg=""):
     if perms.is_admin(ctx.message) or perms.is_lmao_developer(ctx.message):
         if len(ctx.message.mentions) == 1:
             if str(ctx.message.mentions[0].id) not in lbvars.get_lmao_admin_list(ctx.guild.id):
                 await ctx.send(ctx.message.mentions[0].name + " is not a lmao administrator.")
             else:
                 lbvars.set_lmao_admin_list(ctx.guild.id, [admin for admin in lbvars.get_lmao_admin_list(ctx.guild.id) if admin != str(ctx.message.mentions[0].id)])
                 await ctx.send(ctx.message.mentions[0].mention + " has been removed as a lmao administrator for this guild.")
         elif len(ctx.message.mentions) > 1:
             await ctx.send(f"{ctx.author.mention} You may only remove 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 remove as a lmao administrator.")
     else:
         await ctx.send(f"{ctx.author.mention} Only guild administrators can remove lmao administrators.")
     usage.update(ctx)
     return ctx.command.name
Exemple #29
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
Exemple #30
0
 async def cmd_guess(self, ctx, guess=""):
     if ctx.guild.id not in self.magic_number:
         self.magic_number[ctx.guild.id] = -1
     if ctx.guild.id not in self.guess_count:
         self.guess_count[ctx.guild.id] = 0
     if self.magic_number[ctx.guild.id] == -1:
         if guess == "start":
             self.magic_number[ctx.guild.id] = random.randint(0,100)
             print(str(datetime.now()) + " " + "Magic number for {}: {}".format(ctx.guild.name, self.magic_number[ctx.guild.id]))
             await ctx.send("I'm thinking of a number from 0 to 100. Can you guess what it is? :thinking:")
         else:
             try:
                 number_guess = int(guess)
                 await ctx.send(f"A guessing game is currently not in progress. To start one, say `{ctx.prefix}guess start`.")
             except ValueError:
                 if guess == "giveup":
                     await ctx.send(f"A guessing game is currently not in progress. To start one, say `{ctx.prefix}guess start`.")
                 else:
                     await self.bot.get_command("replaceass").invoke(ctx)
     else:
         try:
             number_guess = int(guess)
             if number_guess == self.magic_number[ctx.guild.id]:
                 await ctx.send("Congratulations! " + str(number_guess) + " is correct!")
                 self.guess_count[ctx.guild.id] += 1
                 self.magic_number[ctx.guild.id] = -1
                 await ctx.send("It took you " + str(self.guess_count[ctx.guild.id]) + " guesses to guess my number.")
                 self.guess_count[ctx.guild.id] = 0
             elif number_guess < self.magic_number[ctx.guild.id]:
                 await ctx.send(str(number_guess) + " is too low!")
                 self.guess_count[ctx.guild.id] += 1
             elif number_guess > self.magic_number[ctx.guild.id]:
                 await ctx.send(str(number_guess) + " is too high!")
                 self.guess_count[ctx.guild.id] += 1
             else:
                 await ctx.send('Your guess must be an integer from 0 to 100!')
         except ValueError:
             if guess == "giveup" or guess == "quit" or guess == "exit":
                 await ctx.send('After ' + str(self.guess_count[ctx.guild.id]) + r' guesses, you have already given up (_psst_ my number was ' + str(self.magic_number[ctx.guild.id]) + r"). What's the point in playing if you're not even going to try?")
                 self.magic_number[ctx.guild.id] = -1
                 self.guess_count[ctx.guild.id] = 0
             elif guess == "start":
                 await ctx.send('A game is already in progress!')
             else:
                 await self.bot.get_command("replaceass").invoke(ctx)
     usage.update(ctx, guess)
     return ctx.command.name