fixed playerlink issue
This commit is contained in:
@@ -24,6 +24,8 @@ class PlayerError(Exception):
|
||||
pass
|
||||
class WrongCodeError(Exception):
|
||||
pass
|
||||
class TimerExpiredError(Exception):
|
||||
pass
|
||||
|
||||
def get_player_uuid(minecraftname):
|
||||
HOST = '192.168.1.214' # The server's hostname or IP address
|
||||
@@ -91,6 +93,9 @@ class PlayerLink(commands.Cog):
|
||||
if isinstance(error, WrongCodeError):
|
||||
embed.add_field(name="Error", value=f"The code is wrong!", inline=False)
|
||||
embed.colour = discord.Colour.red()
|
||||
elif isinstance(error, TimerExpiredError):
|
||||
embed.colour = discord.Colour.red()
|
||||
embed.add_field(name="Timer", value=f"The timer expired!", inline=False)
|
||||
elif (success == True):
|
||||
embed.add_field(name="Success", value=f"The link was successfull!", inline=False)
|
||||
embed.colour = discord.Colour.green()
|
||||
@@ -116,6 +121,7 @@ class PlayerLink(commands.Cog):
|
||||
asyncio.create_task(message.edit(embed=create_embed(ctx.author, arg, timer)))
|
||||
await asyncio.sleep(1)
|
||||
|
||||
message = None
|
||||
|
||||
try:
|
||||
|
||||
@@ -151,6 +157,11 @@ class PlayerLink(commands.Cog):
|
||||
|
||||
except PlayerError:
|
||||
await ctx.send("Player '" + arg + "' not found")
|
||||
except asyncio.TimeoutError:
|
||||
if message != None:
|
||||
await message.edit(embed=create_embed(ctx.author, arg, timer, TimerExpiredError()))
|
||||
|
||||
|
||||
# except:
|
||||
# await ctx.send("Something went wrong")
|
||||
|
||||
|
||||
@@ -246,10 +246,6 @@ class Quiz(commands.Cog):
|
||||
playerdblinker = PlayerDBLinker()
|
||||
linked = playerdblinker.discordidused(message.author.id)
|
||||
await message.channel.send(embed=self.create_answer_embed(question[1], question[2], question[3] * streak, streak, message.author, linked, True))
|
||||
|
||||
if streak > 1:
|
||||
await message.channel.send(f"{message.author.mention} has a streak going of {streak}")
|
||||
|
||||
playerdblinker.close()
|
||||
except asyncio.TimeoutError:
|
||||
self.reset_current_streak()
|
||||
|
||||
Reference in New Issue
Block a user