🐛 Change the way defer works, so it's all done by the bot instance

This commit is contained in:
NikolajDanger
2021-04-12 10:20:25 +02:00
parent 1acc0d407d
commit 78d8575e15
12 changed files with 31 additions and 61 deletions

View File

@ -172,10 +172,7 @@ class Blackjack():
# When players try to hit
async def hit(self, ctx, handNumber = 0):
try:
await ctx.defer()
except:
self.bot.log("Defer failed")
await self.bot.defer(ctx)
channel = str(ctx.channel_id)
user = f"#{ctx.author.id}"
roundDone = False
@ -239,10 +236,7 @@ class Blackjack():
# When players try to double down
async def double(self, ctx, handNumber = 0):
try:
await ctx.defer()
except:
self.bot.log("Defer failed")
await self.bot.defer(ctx)
channel = str(ctx.channel_id)
user = f"#{ctx.author.id}"
roundDone = False
@ -317,10 +311,7 @@ class Blackjack():
# When players try to stand
async def stand(self, ctx, handNumber = 0):
try:
await ctx.defer()
except:
self.bot.log("Defer failed")
await self.bot.defer(ctx)
channel = str(ctx.channel_id)
user = f"#{ctx.author.id}"
roundDone = False
@ -378,10 +369,7 @@ class Blackjack():
# When players try to split
async def split(self, ctx, handNumber = 0):
try:
await ctx.defer()
except:
self.bot.log("Defer failed")
await self.bot.defer(ctx)
channel = str(ctx.channel_id)
user = f"#{ctx.author.id}"
roundDone = False
@ -506,10 +494,7 @@ class Blackjack():
# Player enters the game and draws a hand
async def playerDrawHand(self, ctx, bet : int):
try:
await ctx.defer()
except:
self.bot.log("Defer failed")
await self.bot.defer(ctx)
channel = str(ctx.channel_id)
user = f"#{ctx.author.id}"
collection = self.bot.database["blackjack games"]
@ -565,10 +550,7 @@ class Blackjack():
# Starts a game of blackjack
async def start(self, ctx):
try:
await ctx.defer()
except:
self.bot.log("Defer failed")
await self.bot.defer(ctx)
channel = str(ctx.channel_id)
blackjackMinCards = 50
blackjackDecks = 4