Random Guild Selection from Server List

  • Share this:

Code introduction


This function randomly selects a guild from a given list of servers and returns it. If the server list is empty, it returns None.


Technology Stack : Discord.py

Code Type : Discord.py Function

Code Difficulty : Intermediate


                
                    
def get_random_guild(guilds):
    import random
    if not guilds:
        return None
    return random.choice(guilds)                
              
Tags: