🐛 Change the way defer works, so it's all done by the bot instance
This commit is contained in:
@ -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
|
||||
|
@ -26,10 +26,7 @@ class ConnectFour():
|
||||
|
||||
# Starts the game
|
||||
async def start(self, ctx, opponent):
|
||||
try:
|
||||
await ctx.defer()
|
||||
except:
|
||||
self.bot.log("Defer failed")
|
||||
await self.bot.defer(ctx)
|
||||
user = f"#{ctx.author.id}"
|
||||
channel = str(ctx.channel_id)
|
||||
game = self.bot.database["connect 4 games"].find_one({"_id":channel})
|
||||
@ -228,10 +225,7 @@ class ConnectFour():
|
||||
|
||||
# Parses command
|
||||
async def surrender(self, ctx):
|
||||
try:
|
||||
await ctx.defer()
|
||||
except:
|
||||
self.bot.log("Defer failed")
|
||||
await self.bot.defer(ctx)
|
||||
channel = str(ctx.channel_id)
|
||||
game = self.bot.database["connect 4 games"].find_one({"_id":channel})
|
||||
|
||||
|
@ -10,7 +10,7 @@ class Hangman():
|
||||
self.draw = DrawHangman(bot)
|
||||
|
||||
async def start(self, ctx):
|
||||
await ctx.defer()
|
||||
await self.bot.defer(ctx)
|
||||
channel = str(ctx.channel_id)
|
||||
user = f"#{ctx.author.id}"
|
||||
game = self.bot.database["hangman games"].find_one({"_id":channel})
|
||||
|
@ -93,10 +93,7 @@ class HexGame():
|
||||
|
||||
# Starts the game
|
||||
async def start(self, ctx, opponent):
|
||||
try:
|
||||
await ctx.defer()
|
||||
except:
|
||||
self.bot.log("Defer failed")
|
||||
await self.bot.defer(ctx)
|
||||
user = f"#{ctx.author.id}"
|
||||
channel = str(ctx.channel_id)
|
||||
game = self.bot.database["hex games"].find_one({"_id":channel})
|
||||
|
@ -106,10 +106,7 @@ class Invest():
|
||||
return "no"
|
||||
|
||||
async def parseInvest(self, ctx, parameters):
|
||||
try:
|
||||
await ctx.defer()
|
||||
except:
|
||||
self.bot.log("Defer failed")
|
||||
await self.bot.defer(ctx)
|
||||
user = f"#{ctx.author.id}"
|
||||
|
||||
if parameters.startswith("check"):
|
||||
|
@ -15,7 +15,7 @@ class Money():
|
||||
else: return 0
|
||||
|
||||
async def sendBalance(self, ctx):
|
||||
await ctx.defer()
|
||||
await self.bot.defer(ctx)
|
||||
response = self.checkBalance("#"+str(ctx.author.id))
|
||||
if response == 1:
|
||||
new_message = ctx.author.display_name + " has " + str(response) + " GwendoBuck"
|
||||
@ -36,10 +36,7 @@ class Money():
|
||||
|
||||
# Transfers money from one user to another
|
||||
async def giveMoney(self, ctx, user, amount):
|
||||
try:
|
||||
await ctx.defer()
|
||||
except:
|
||||
self.bot.log("Defer failed")
|
||||
await self.bot.defer(ctx)
|
||||
username = user.display_name
|
||||
if self.bot.databaseFuncs.getID(username) == None:
|
||||
async for member in ctx.guild.fetch_members(limit=None):
|
||||
|
@ -86,10 +86,7 @@ class Trivia():
|
||||
return None
|
||||
|
||||
async def triviaParse(self, ctx, answer):
|
||||
try:
|
||||
await ctx.defer()
|
||||
except:
|
||||
self.bot.log("defer failed")
|
||||
await self.bot.defer(ctx)
|
||||
if answer == "":
|
||||
question, options, correctAnswer = self.triviaStart(str(ctx.channel_id))
|
||||
if options != "":
|
||||
|
Reference in New Issue
Block a user