So, I'm making a text based game and I want that whenever a user types a command my bit DMS the user and starts the story for that user. I'm not sure how to do this for multiple users. Like if a game has already been initiated and someone else wants to start a new one they should be able to irrespective to the progress of the user that is already playing
How to send messages to multiple users via bot to individually irrespective of others in discord.py?
Asked
Active
Viewed 159 times
-2
-
Well, what have you tried so far? We do not code all of this for you. Please include your code, approaches and errors you face. You may also take a look at [how to ask a good question](https://stackoverflow.com/help/how-to-ask) – Dominik Aug 01 '21 at 11:27
1 Answers
0
Well since you haven't provided any code it will have to be a description based answer.
For storing data in cache use a dictionary
data = {}
...
data[member.id] = {level: 0, money: 0}
This would storage the variables level and money inside the data
variable you can access it with data[member.id]
.
If you are wanting to store data over long term have a look at databases such as MongoDB or MySQL/MariaDB.
Your code must be async otherwise there will be blocking while things are being calculated. For example, if you are fetching data using requests
use aiohttp
or another asynchronous library for it.

Axisnix
- 2,822
- 5
- 19
- 41