Search code examples
pythondiscorddiscord.py

What is the easiest way to get list of all guild ids? Discord.py


My question is simple, I was searching for this on the internet but i haven't found anything helpful.

Can someone tell me what is the easiest way to get list of all bot.guilds ids? Maybe you guys know how to get it as interger? It would be the best.


Solution

  • This code should work:

    for guild in client.guilds:
        print(guild.id)
        
    

    You can use it on on ready event, or for a command.