Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

discord api python putting ids in a list

@client.event
async def on_ready():
    guilds = client.guilds
    data = {}
    for guild in guilds:
        data[guild.id] = []
        for channel in guild.channels:
            data[guild.id].append(channel.id)
    with open("./data/guilds.json", "w") as file:
        json.dump(data, file, indent=4)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #discord #api #python #putting #ids #list
ADD COMMENT
Topic
Name
5+6 =