Compare commits

...

4 Commits

2 changed files with 19 additions and 3 deletions

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
discord.py==2.2.3
fastf1==3.0.3
Requests==2.31.0

View File

@@ -125,6 +125,10 @@ class Robottas(commands.Bot):
elif category == "OTHER":
if self.session_type == "RACE" and "DELETED" in message['Message']:
pass
elif "SLIPPERY" in message['Message'] and \
not self.is_slippery_reported:
self.is_slippery_reported = True
report = "It's slippery out there!"
else:
report = message['Message']
@@ -158,6 +162,11 @@ class Robottas(commands.Bot):
if self.current_lap != current_lap:
self.current_lap = current_lap
#Re-evaluate total laps in case it has changed
#i.e. shortened due to rain.
if "TotalLaps" in data.keys():
self.total_laps = int(data["TotalLaps"])
#Notify on lap change if matches a driver
key = str(self.total_laps - int(current_lap))
if key in self.driver_dict.keys():
@@ -533,6 +542,7 @@ class Robottas(commands.Bot):
async def start_collect(self):
self.is_collecting = True
self.is_slippery_reported = False
dir_path = os.path.dirname(os.path.realpath(__file__))
command_txt = os.path.join(dir_path, self.collector_command)
command_txt += self.collector_params
@@ -581,6 +591,9 @@ class Robottas(commands.Bot):
# Hold weather info
self.weather = ""
# Hold weather we have reported on slippery track.
self.is_slippery_reported = False
# Hold lap info
self.current_lap = -1000
@@ -729,12 +742,12 @@ class Robottas(commands.Bot):
try:
secs = int(delay)
if secs < 10 or secs > 300:
await ctx.send("delay must be between 10 and 300")
await ctx.send("Delay must be between 10 and 300.")
else:
self.delay = secs
await ctx.send(f"delay set to {secs}")
await ctx.send(f"Delay set to {secs} seconds.")
except:
await ctx.send("invalid delay value")
await ctx.send(f"Invalid delay value ({secs}).")
@self.command()