More converting

This commit is contained in:
Nikolaj Danger
2021-03-30 18:27:47 +02:00
parent e8c7fb95e5
commit a8a7e5eabd
7 changed files with 113 additions and 74 deletions

View File

@ -24,6 +24,7 @@ class GamesCog(commands.Cog):
# Checks user balance
@cog_ext.cog_slash(**params["balance"])
async def balance(self, ctx):
await ctx.defer()
response = self.bot.money.checkBalance("#"+str(ctx.author.id))
if response == 1:
new_message = ctx.author.display_name + " has " + str(response) + " GwendoBuck"
@ -34,6 +35,7 @@ class GamesCog(commands.Cog):
# Gives another user an amount of GwendoBucks
@cog_ext.cog_slash(**params["give"])
async def give(self, ctx, parameters):
await ctx.defer()
commands = parameters.split(" ")
amount = int(commands[-1])
username = " ".join(commands[:-1])
@ -49,6 +51,7 @@ class GamesCog(commands.Cog):
# Invest GwendoBucks in the stock market
@cog_ext.cog_slash(**params["invest"])
async def invest(self, ctx, parameters = "check"):
await ctx.defer()
response = self.bot.invest.parseInvest(parameters,"#"+str(ctx.author.id))
if response.startswith("**"):
responses = response.split("\n")
@ -60,6 +63,7 @@ class GamesCog(commands.Cog):
# Runs a game of trivia
@cog_ext.cog_slash(**params["trivia"])
async def trivia(self, ctx, answer = ""):
await ctx.defer()
if answer == "":
question, options, correctAnswer = self.bot.trivia.triviaStart(str(ctx.channel_id))
if options != "":
@ -93,16 +97,19 @@ class GamesCog(commands.Cog):
# Runs a game of blackjack
@cog_ext.cog_slash(**params["blackjack"])
async def blackjack(self, ctx, parameters = ""):
await ctx.defer()
await self.bot.blackjack.parseBlackjack(parameters, ctx)
# Start a game of connect four against a user
@cog_ext.cog_subcommand(**params["connectFourStartUser"])
async def connectFourStartUser(self, ctx, user):
await ctx.defer()
await self.bot.gameLoops.connectFour(ctx, "start "+user.display_name)
# Start a game of connect four against gwendolyn
@cog_ext.cog_subcommand(**params["connectFourStartGwendolyn"])
async def connectFourStartGwendolyn(self, ctx, difficulty = 3):
await ctx.defer()
await self.bot.gameLoops.connectFour(ctx, "start "+str(difficulty))
# Stop the current game of connect four
@ -118,6 +125,7 @@ class GamesCog(commands.Cog):
# Starts a game of Hangman
@cog_ext.cog_subcommand(**params["hangmanStart"])
async def hangmanStart(self, ctx):
await ctx.defer()
await self.bot.gameLoops.runHangman(ctx.channel,"#"+str(ctx.author.id),"start", ctx)
# Stops a game of Hangman
@ -128,11 +136,13 @@ class GamesCog(commands.Cog):
# Start a game of Hex against another user
@cog_ext.cog_subcommand(**params["hexStartUser"])
async def hexStartUser(self, ctx, user):
await ctx.defer()
await self.bot.gameLoops.runHex(ctx, "start "+user.display_name, "#"+str(ctx.author.id))
# Start a game of Hex against Gwendolyn
@cog_ext.cog_subcommand(**params["hexStartGwendolyn"])
async def hexStartGwendolyn(self, ctx, difficulty = 2):
await ctx.defer()
await self.bot.gameLoops.runHex(ctx, "start "+str(difficulty), "#"+str(ctx.author.id))
# Undo your last hex move