-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
65 lines (52 loc) · 1.62 KB
/
main.py
File metadata and controls
65 lines (52 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import discord
import config
import os
import asyncio
import fiadocs as fia
from discord.ext import commands
# fastf1.Cache.enable_cache('cache/')
# basic bot setup
########################################
# token = open('token.txt').readline()
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
bot = commands.Bot(command_prefix='f1$', intents=intents)
########################################
# On Ready
@bot.event
async def on_ready():
print(f'Logged in as {bot.user}')
# create thread to check for new fia documents
await fia.createDocThread(bot)
@bot.event
async def load():
for file in os.listdir('./cogs'):
if file.endswith('.py'):
await bot.load_extension(f'cogs.{file[:-3]}')
# for file in os.listdir('./cogsmotogp'):
# if file.endswith('.py'):
# await bot.load_extension(f'cogsmotogp.{file[:-3]}')
async def main():
await load()
########################################
# START BOT
await bot.start(config.TOKEN)
########################################
asyncio.run(main())
########################################
#
# FastF1 example Hamilton vs Magnussen lap times 2020 Turkish GP
#
########################################
# race = fastf1.get_session(2020, 'Turkish Grand Prix', 'R')
# race.load()
# mag = race.laps.pick_driver('MAG')
# ham = race.laps.pick_driver('HAM')
# fig, ax = plt.subplots()
# ax.plot(mag['LapNumber'], mag['LapTime'], color='white')
# ax.plot(ham['LapNumber'], ham['LapTime'], color='cyan')
# ax.set_title("MAG vs HAM")
# ax.set_xlabel("Lap Number")
# ax.set_ylabel("Lap Time")
# plt.show()