Update transactions.py
Add timeout error handler
This commit is contained in:
parent
222144ecbf
commit
0ae150d36e
@ -751,6 +751,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await trade.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await trade.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await trade.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
# Check that player is on one of the teams
|
||||
# Check that the player hasn't been dropped (IL is okay)
|
||||
@ -899,6 +904,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await trade.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await trade.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await trade.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if not trade.included_team(player['team']):
|
||||
await t_channel.send(f'It looks like {player.name} is on {player.team.abbrev} '
|
||||
@ -1259,6 +1269,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
fa_team = await get_one_team('FA')
|
||||
dest_team = await get_one_team(f'{team["abbrev"]}MiL')
|
||||
@ -1307,6 +1322,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if OFFSEASON_FLAG:
|
||||
if not self.on_team_il(team, player):
|
||||
@ -1362,6 +1382,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if not dropadd.included_team(player['team']):
|
||||
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
|
||||
@ -1505,6 +1530,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if not dropadd.included_team(player['team']):
|
||||
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
|
||||
@ -1545,6 +1575,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if not self.on_team_il(team, player):
|
||||
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
|
||||
@ -1584,6 +1619,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if not dropadd.included_team(player['team']):
|
||||
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
|
||||
@ -1627,6 +1667,11 @@ class Transactions(commands.Cog):
|
||||
except ValueError:
|
||||
await dropadd.send(f'{await get_emoji(ctx, "squint")}')
|
||||
await dropadd.send('Who even is that? Try again.')
|
||||
except requests.ReadTimeout:
|
||||
await dropadd.send(
|
||||
f'I\'m dumb and couldn\'t read from the database fast enough. '
|
||||
f'{await get_emoji(ctx, "dead")} Let\'s try that again.'
|
||||
)
|
||||
else:
|
||||
if not dropadd.included_team(player['team']):
|
||||
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
|
||||
|
||||
Loading…
Reference in New Issue
Block a user