-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (25 loc) · 720 Bytes
/
main.py
File metadata and controls
37 lines (25 loc) · 720 Bytes
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
import json
import discord
from discord.ext import tasks
import server
client = discord.Client(intents=discord.Intents.default())
with open('configuration.json') as file:
config = json.load(file)
token = config.get('token')
trackers_data = config.get('servers')
trackers: list[server.Tracker] = []
for tracker in trackers_data:
trackers.append(server.Tracker.from_data(tracker))
@tasks.loop(seconds=5)
async def update():
for tracker in trackers:
await tracker.update(client)
launched = False
@client.event
async def on_ready():
global launched
if not launched:
update.start()
launched = True
print(f"Ready! Connected as {client.user.name}!")
client.run(token)