auto discover guilds
This commit is contained in:
parent
7618f309ba
commit
b49ed138b6
6
main.py
6
main.py
@ -19,10 +19,11 @@ client.modules: list[BaseModule] = []
|
|||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
client.modules = [m(client) for m in MODULES]
|
client.modules = [m(client) for m in MODULES]
|
||||||
await tree.sync(guild=discord.Object(id=gitea.GUILD_ID))
|
|
||||||
for m in client.modules:
|
for m in client.modules:
|
||||||
await m.load()
|
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
|
@client.event
|
||||||
@ -44,6 +45,5 @@ async def on_message(message):
|
|||||||
if not handled:
|
if not handled:
|
||||||
handled = await m.handle_message(message)
|
handled = await m.handle_message(message)
|
||||||
|
|
||||||
|
|
||||||
# Initialise le client
|
# Initialise le client
|
||||||
client.run(token)
|
client.run(token)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user