You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
3.8KB

  1. import discord
  2. import random
  3. import checks
  4. from discord.ext.commands import bot
  5. class Fun:
  6. def __init__(self, bot_client):
  7. self.bot = bot_client
  8. @bot.command()
  9. async def roll(self, ctx, die):
  10. """
  11. Rolls a die using ndx format.
  12. Usage:
  13. {command_prefix}roll ndx
  14. Example:
  15. .roll 2d20 # Rolls two D20s
  16. """
  17. dice = 0
  18. if die[0].isdigit():
  19. if die[1].isdigit() or die[0] == 0:
  20. return await ctx.send("I only support multipliers from 1-9")
  21. multiplier = int(die[0])
  22. else:
  23. multiplier = 1
  24. if die[1].lower() != "d" and die[0].lower() != "d":
  25. return await ctx.send("Use the format 'ndx'.")
  26. options = (4, 6, 8, 10, 12, 20, 100)
  27. for option in options:
  28. if die.endswith(str(option)):
  29. dice = option
  30. if dice == 0:
  31. return await ctx.send("You didn't give a die to use.")
  32. rolls = []
  33. if dice == 100:
  34. step = 10
  35. else:
  36. step = 1
  37. total = 0
  38. if multiplier > 1:
  39. for x in range(multiplier):
  40. rolls.append(random.randrange(step, dice+1, step))
  41. for r in rolls:
  42. total += r
  43. return await ctx.send("{} rolled **{}**. Totaling **{}**".format(ctx.message.author.mention, rolls, total))
  44. else:
  45. roll = random.randrange(step, dice + 1, step)
  46. return await ctx.send("{} rolled a **{}**".format(ctx.message.author.mention, roll))
  47. @checks.isnt_anal()
  48. @bot.command()
  49. async def spank(self, ctx, *, user: discord.User = None):
  50. """
  51. Spanks the mentioned user ;)
  52. Usage:
  53. {command_prefix}spank @Roxbot_client#4170
  54. {command_prefix}spank Roxbot_client
  55. """
  56. if not user:
  57. return await ctx.send("You didn't mention someone for me to spank")
  58. return await ctx.send(":peach: :wave: *{} spanks {}*".format(self.bot.user.name, user.name))
  59. @checks.isnt_anal()
  60. @bot.command(aliases=["succ"])
  61. async def suck(self, ctx, *, user: discord.User = None):
  62. """
  63. Sucks the mentioned user ;)
  64. Usage:
  65. {command_prefix}suck @Roxbot_client#4170
  66. {command_prefix}suck Roxbot_client
  67. """
  68. if not user:
  69. return await ctx.send("You didn't mention someone for me to suck")
  70. return await ctx.send(":eggplant: :sweat_drops: :tongue: *{} sucks {}*".format(self.bot.user.name, user.name))
  71. @bot.command()
  72. async def hug(self, ctx, *, user: discord.User = None):
  73. """
  74. Hugs the mentioned user :3
  75. Usage:
  76. {command_prefix}hug @Roxbot_client#4170
  77. {command_prefix}hug Roxbot_client
  78. """
  79. if not user:
  80. return await ctx.send("You didn't mention someone for me to hug")
  81. return await ctx.send(":blush: *{} hugs {}*".format(self.bot.user.name, user.name))
  82. @bot.command(aliases=["wf"])
  83. async def waifurate(self, ctx):
  84. """
  85. Rates the mentioned waifu(s)
  86. Usage:
  87. {command_prefix}waifurate @user#9999
  88. """
  89. mentions = ctx.message.mentions
  90. if not mentions:
  91. return await self.bot.reply("You didn't mention anyone for me to rate.", delete_after=10)
  92. rating = random.randrange(1, 11)
  93. if rating <= 2:
  94. emoji = ":sob:"
  95. elif rating <= 4:
  96. emoji = ":disappointed:"
  97. elif rating <= 6:
  98. emoji = ":thinking:"
  99. elif rating <= 8:
  100. emoji = ":blush:"
  101. elif rating == 9:
  102. emoji = ":kissing_heart:"
  103. else:
  104. emoji = ":heart_eyes:"
  105. if len(mentions) > 1:
  106. return await ctx.send("Oh poly waifu rating? :smirk: Your combined waifu rating is {}/10. {}".format(rating, emoji))
  107. else:
  108. return await ctx.send("Oh that's your waifu? I rate them a {}/10. {}".format(rating, emoji))
  109. @bot.command(aliases=["cf"])
  110. async def coinflip(self, ctx):
  111. """Flip a coin"""
  112. return await ctx.send("The coin landed on {}!".format(random.choice(["heads", "tails"])))
  113. @bot.command()
  114. async def aesthetics(self, ctx, *convert):
  115. """Converts text to be more a e s t h e t i c s"""
  116. WIDE_MAP = dict((i, i + 0xFEE0) for i in range(0x21, 0x7F))
  117. WIDE_MAP[0x20] = 0x3000
  118. convert = str(' '.join(convert)).translate(WIDE_MAP)
  119. return await ctx.send(convert)
  120. def setup(bot_client):
  121. bot_client.add_cog(Fun(bot_client))