Browse Source

Fun cog converted over to 1.0

tags/v1.4.0
roxie 6 years ago
parent
commit
61346b074b
1 changed files with 33 additions and 34 deletions
  1. +33
    -34
      cogs/fun.py

+ 33
- 34
cogs/fun.py View File

@@ -4,11 +4,11 @@ import checks
from discord.ext.commands import bot


class Fun():
def __init__(self, Bot):
self.bot = Bot
class Fun:
def __init__(self, bot_client):
self.bot = bot_client

@bot.command(pass_context=True)
@bot.command()
async def roll(self, ctx, die):
"""
Rolls a die using ndx format.
@@ -17,22 +17,21 @@ class Fun():
Example:
.roll 2d20 # Rolls two D20s
"""
# TODO: Change to ndx format
dice = 0
if die[0].isdigit():
if die[1].isdigit() or die[0] == 0:
return await self.bot.say("I only support multipliers from 1-9")
return await ctx.send("I only support multipliers from 1-9")
multiplier = int(die[0])
else:
multiplier = 1
if die[1].lower() != "d" and die[0].lower() != "d":
return await self.bot.say("Use the format 'ndx'.")
return await ctx.send("Use the format 'ndx'.")
options = (4, 6, 8, 10, 12, 20, 100)
for option in options:
if die.endswith(str(option)):
dice = option
if dice == 0:
return await self.bot.say("You didn't give a die to use.")
return await ctx.send("You didn't give a die to use.")

rolls = []
if dice == 100:
@@ -46,50 +45,50 @@ class Fun():
rolls.append(random.randrange(step, dice+1, step))
for r in rolls:
total += r
return await self.bot.say("{} rolled **{}**. Totaling **{}**".format(ctx.message.author.mention, rolls, total))
return await ctx.send("{} rolled **{}**. Totaling **{}**".format(ctx.message.author.mention, rolls, total))
else:
roll = random.randrange(step, dice + 1, step)
return await self.bot.say("{} rolled a **{}**".format(ctx.message.author.mention, roll))
return await ctx.send("{} rolled a **{}**".format(ctx.message.author.mention, roll))

@checks.isnt_anal()
@bot.command(pass_context=True)
@bot.command()
async def spank(self, ctx, *, user: discord.User = None):
"""
Spanks the mentioned user ;)
Usage:
{command_prefix}spank @RoxBot#4170
{command_prefix}spank RoxBot
{command_prefix}spank @Roxbot_client#4170
{command_prefix}spank Roxbot_client
"""
if not user:
return await self.bot.say("You didn't mention someone for me to spank")
return await self.bot.say(":peach: :wave: *{} spanks {}*".format(self.bot.user.name, user.name))
return await ctx.send("You didn't mention someone for me to spank")
return await ctx.send(":peach: :wave: *{} spanks {}*".format(self.bot.user.name, user.name))

@checks.isnt_anal()
@bot.command(pass_context=True, aliases=["succ"])
@bot.command(aliases=["succ"])
async def suck(self, ctx, *, user: discord.User = None):
"""
Sucks the mentioned user ;)
Usage:
{command_prefix}suck @RoxBot#4170
{command_prefix}suck RoxBot
{command_prefix}suck @Roxbot_client#4170
{command_prefix}suck Roxbot_client
"""
if not user:
return await self.bot.say("You didn't mention someone for me to suck")
return await self.bot.say(":eggplant: :sweat_drops: :tongue: *{} sucks {}*".format(self.bot.user.name, user.name))
return await ctx.send("You didn't mention someone for me to suck")
return await ctx.send(":eggplant: :sweat_drops: :tongue: *{} sucks {}*".format(self.bot.user.name, user.name))

@bot.command(pass_context=True)
@bot.command()
async def hug(self, ctx, *, user: discord.User = None):
"""
Hugs the mentioned user :3
Usage:
{command_prefix}hug @RoxBot#4170
{command_prefix}hug RoxBot
{command_prefix}hug @Roxbot_client#4170
{command_prefix}hug Roxbot_client
"""
if not user:
return await self.bot.say("You didn't mention someone for me to hug")
return await self.bot.say(":blush: *{} hugs {}*".format(self.bot.user.name, user.name))
return await ctx.send("You didn't mention someone for me to hug")
return await ctx.send(":blush: *{} hugs {}*".format(self.bot.user.name, user.name))

@bot.command(pass_context=True, aliases=["wf"])
@bot.command(aliases=["wf"])
async def waifurate(self, ctx):
"""
Rates the mentioned waifu(s)
@@ -115,23 +114,23 @@ class Fun():
emoji = ":heart_eyes:"

if len(mentions) > 1:
return await self.bot.say("Oh poly waifu rating? :smirk: Your combined waifu rating is {}/10. {}".format(rating, emoji))
return await ctx.send("Oh poly waifu rating? :smirk: Your combined waifu rating is {}/10. {}".format(rating, emoji))
else:
return await self.bot.say("Oh that's your waifu? I rate them a {}/10. {}".format(rating, emoji))
return await ctx.send("Oh that's your waifu? I rate them a {}/10. {}".format(rating, emoji))

@bot.command(pass_context=True, aliases=["cf"])
@bot.command(aliases=["cf"])
async def coinflip(self, ctx):
"""Flip a coin"""
return await self.bot.reply("the coin landed on {}!".format(random.choice(["heads", "tails"])))
return await ctx.send("The coin landed on {}!".format(random.choice(["heads", "tails"])))

@bot.command(pass_context=True)
@bot.command()
async def aesthetics(self, ctx, *convert):
"""Converts text to be more a e s t h e t i c s"""
WIDE_MAP = dict((i, i + 0xFEE0) for i in range(0x21, 0x7F))
WIDE_MAP[0x20] = 0x3000
convert = str(' '.join(convert)).translate(WIDE_MAP)
return await self.bot.say(convert)
return await ctx.send(convert)


def setup(Bot):
Bot.add_cog(Fun(Bot))
def setup(bot_client):
bot_client.add_cog(Fun(bot_client))

Loading…
Cancel
Save