auto discover guilds

This commit is contained in:
Lendemor 2024-05-12 14:55:13 +02:00
parent 7618f309ba
commit b49ed138b6

View File

@ -19,10 +19,11 @@ client.modules: list[BaseModule] = []
@client.event
async def on_ready():
client.modules = [m(client) for m in MODULES]
await tree.sync(guild=discord.Object(id=gitea.GUILD_ID))
for m in client.modules:
await m.load()
print(f"Logged in as {client.user}")
async for guild in client.fetch_guilds():
await tree.sync(guild=discord.Object(id=guild.id))
print(f"Logged in as {client.user} on {len(client.guilds)} servers!")
@client.event
@ -44,6 +45,5 @@ async def on_message(message):
if not handled:
handled = await m.handle_message(message)
# Initialise le client
client.run(token)