Creating a Discord Bot Game with Emojis

I have developed a game using emojis and below is the code I am currently utilizing, which functions as intended.

@bot.command()
async def play_game(ctx):
    items = ['car', 'boat', 'dog', 'lion', 'cat', 'bird']
    first = items[random.randint(0, 5)]
    second = items[random.randint(0, 5)]

    result = '| :{}: | :{}: |
'.format(first, second)

    if first == second:
        await ctx.send("{}\nYou Win!".format(result))
    else:
        await ctx.send("{}\nYou Lose!".format(result))

However, I would like assistance in making the emojis change randomly, similar to the example shown in the image.

u can try using the random.choice method instead of random.randint. It will be like first = random.choice(items) and same for second. That should mke the emojis look like they’re changing randomly :slight_smile:

One alternative you could explore is using asynchronous functions to introduce a delay or animation-like effect when generating the emojis. Consider using the asyncio.sleep() function to pause between changes momentarily, creating a more dynamic appearance of changing emojis. You can loop through a list of emojis a few times before presenting the final outcome, allowing your Discord users to experience a more interactive and engaging game play apart from the final result.

You might want to try adjusting the pool of items periodically or in real-time by fetching new emojis dynamically from some online source. You can implement a method that updates items with a fresh batch each time the game runs, adding an element of surprise to each game session. Simply utilize an API that offers emoji listings, or scrape a regularly updated source. It adds an additional layer of unpredictability and freshness each time users engage with your bot.