fix rps, add mentions

This commit is contained in:
Akumatic 2019-01-22 01:07:52 +01:00
parent 48e7b2fb0e
commit f873ff60ae

View File

@ -8,26 +8,26 @@ class Fun():
@commands.command() @commands.command()
async def ping(self, ctx): async def ping(self, ctx):
"""Ping, Pong""" """Ping, Pong"""
await ctx.send("Pong!") await ctx.send(ctx.author.mention + "Pong!")
@commands.command() @commands.command()
async def dice(self, ctx): async def dice(self, ctx):
"""Throws a six-sided dice.""" """Throws a six-sided dice."""
await ctx.send(random.randint(1,6)) await ctx.send(ctx.author.mention + " You rolled a D6: " + random.randint(1,6))
@commands.command() @commands.command()
async def coin(self, ctx): async def coin(self, ctx):
"""Throws a coin.""" """Throws a coin."""
await ctx.send("Heads" if (random.random() < 0.5) else "Tails") await ctx.send(ctx.author.mention + " Your coin flip is " + "Heads" if (random.random() < 0.5) else "Tails")
@commands.command() @commands.command()
async def rps(self, ctx, userChoice : str): async def rps(self, ctx, userChoice : str=""):
"""Play Rock, Paper, Scissors with the Bot """Play Rock, Paper, Scissors with the Bot
Input \"r\" for Rock, \"p\" for Paper and \"s\" for Scissors""" Input \"r\" for Rock, \"p\" for Paper and \"s\" for Scissors"""
vals = ["r", "p", "s"] vals = ["r", "p", "s"]
userChoice = str.lower(userChoice) userChoice = str.lower(userChoice)
if userChoice not in vals: if userChoice == "" or userChoice not in vals:
await ctx.send(ctx.autor.mention + " Invalid input. Please enter \"r\", \"p\", or \"s\"") await ctx.send(ctx.author.mention + " Invalid input. Please enter \"r\", \"p\", or \"s\"")
else: else:
botChoice = vals[random.randint(0,2)] botChoice = vals[random.randint(0,2)]
if(userChoice == "r" and botChoice == "p"): if(userChoice == "r" and botChoice == "p"):
@ -53,7 +53,7 @@ class Fun():
temp = a temp = a
a = b a = b
b = temp b = temp
await ctx.send("Random roll between " + str(a) + " and " + str(b) + ": " + str(random.randint(a,b))) await ctx.send(ctx.author.mention + " Random roll between " + str(a) + " and " + str(b) + ": " + str(random.randint(a,b)))
#Setup #Setup
def setup(bot): def setup(bot):