Answer the question
In order to leave comments, you need to log in
How to make a system of achievements with pictures, auto-assignment of a role and mini-games like "Guess the number" in a Python discord bot?
I have a discord bot which I made using the guides of one youtuber, but the youtuber made a bot without a function, and I wanted to make it functional, but I didn’t find youtubers doing a normal explanation of functions and events. Can you please give me events/codes for the functionality of the bot? (Which functions are said at the top).
Answer the question
In order to leave comments, you need to log in
Personally, I implemented all this by entering certain commands into the chat. It can be done like this. Let's say you write a certain command to the chat, for example "/start-game". The bot reads this and performs your function on the game itself.
Statistics can be stored using the sqlite3 standard library , and when certain parameters are reached, issue an achievement.
Pictures can be sent like this:
image = Image.open('your\\path\\to\\image.jpg') # открытие картинки
with io.BytesIO() as image_binary:
# перевод картинки в байтовый формат
image.save(image_binary, format="JPEG", quality=95)
image_binary.seek(0)
# отправка картинки
await channel.send(file=discord.File(fp=image_binary, filename="image.jpeg"))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question