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.

110 lines
3.1KB

  1. import discord
  2. import random
  3. from discord.ext.commands import bot
  4. class Fun():
  5. def __init__(self, Bot):
  6. self.bot = Bot
  7. @bot.command(pass_context=True)
  8. async def roll(self, ctx, die):
  9. """
  10. Rolls a die using ndx format.
  11. Usage:
  12. {command_prefix}roll ndx
  13. Example:
  14. .roll 2d20 # Rolls two D20s
  15. """
  16. # TODO: Change to ndx format
  17. dice = 0
  18. if die[0].isdigit():
  19. if die[1].isdigit() or die[0] == 0:
  20. return await self.bot.say("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 self.bot.say("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 self.bot.say("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 self.bot.say("{} rolled **{}**. Totaling **{}**".format(ctx.message.author.mention, rolls, total))
  44. else:
  45. roll = random.randrange(step, dice + 1, step)
  46. return await self.bot.say("{} rolled a **{}**".format(ctx.message.author.mention, roll))
  47. @bot.command(pass_context=True)
  48. async def suck(self, ctx, *, user: discord.User = None):
  49. """
  50. Sucks the mentioned user ;)
  51. Usage:
  52. {command_prefix}suck @RoxBot#4170
  53. {command_prefix}suck RoxBot
  54. """
  55. if not user:
  56. return await self.bot.say("You didn't mention someone for me to suck")
  57. return await self.bot.say(":eggplant: :sweat_drops: :tongue: *{} sucks {}*".format(self.bot.user.name, user.name))
  58. @bot.command(pass_context=True, aliases=["wf"])
  59. async def waifurate(self, ctx):
  60. """
  61. Rates the mentioned waifu(s)
  62. Usage:
  63. {command_prefix}waifurate @user#9999
  64. """
  65. mentions = ctx.message.mentions
  66. if not mentions:
  67. return await self.bot.reply("You didn't mention anyone for me to rate.", delete_after=10)
  68. rating = random.randrange(1, 11)
  69. if rating <= 2:
  70. emoji = ":sob:"
  71. elif rating <= 4:
  72. emoji = ":disappointed:"
  73. elif rating <= 6:
  74. emoji = ":thinking:"
  75. elif rating <= 8:
  76. emoji = ":blush:"
  77. elif rating == 9:
  78. emoji = ":kissing_heart:"
  79. else:
  80. emoji = ":heart_eyes:"
  81. if len(mentions) > 1:
  82. return await self.bot.say("Oh poly waifu rating? :smirk: Your combined waifu rating is {}/10. {}".format(rating, emoji))
  83. else:
  84. return await self.bot.say("Oh that's your waifu? I rate them a {}/10. {}".format(rating, emoji))
  85. @bot.command(pass_context=True, aliases=["cf"])
  86. async def coinflip(self, ctx):
  87. """Flip a coin"""
  88. return await self.bot.reply("the coin landed on {}!".format(random.choice(["heads", "tails"])))
  89. @bot.command(pass_context=True)
  90. async def aesthetics(self, ctx, *convert):
  91. """Converts text to be more a e s t h e t i c s"""
  92. WIDE_MAP = dict((i, i + 0xFEE0) for i in range(0x21, 0x7F))
  93. WIDE_MAP[0x20] = 0x3000
  94. convert = str(' '.join(convert)).translate(WIDE_MAP)
  95. return await self.bot.say(convert)
  96. def setup(Bot):
  97. Bot.add_cog(Fun(Bot))