discord api python putting ids in a list

Solutions on MaxInterview for discord api python putting ids in a list by the best coders in the world

showing results for - "discord api python putting ids in a list"
Gaia
21 Nov 2020
1@client.event
2async def on_ready():
3    guilds = client.guilds
4    data = {}
5    for guild in guilds:
6        data[guild.id] = []
7        for channel in guild.channels:
8            data[guild.id].append(channel.id)
9    with open("./data/guilds.json", "w") as file:
10        json.dump(data, file, indent=4)
11