How can I play on discord from the bot?

I saw several servers that play through a bot. Ex: A bot that made you play Jackpot, another one that made you play Wordle and I want to do the same but with other things. Do you have any idea how to do it?

you would have to make a discord bot, and program the discord bot to play the game with you

Those are Discord Bots.

The common language to create them is either Python or JavaScript.
Both languages have a good documentation about it:

There are several tutorials about how to create them online, this one here uses Replit and JavaScript as an example: