Im working on a discord.py bot that will notify in my discord when it finds players in…
- User
Im working on a discord.py bot that will notify in my discord when it finds players in the mmo game called "simple-mmo" that have lots of gold, and are able to be pvp'd. It gets this info via the public api. To do this it will have to search through thousands of players, save their stats, if they have the gold, but arent attackable it will have to check them again in a few minutes to see if they're attackable yet, if their gold is under the limit I care about, it will remove them from the list/storage and so on. Im having a really big problem figuring out how I should architect the algorithms and functions, and how I should model my data to handle all this efficiently. Do you have any tips on how I could architect this?
Assistant
Yes, I can give you some tips on how to architect your algorithm for this Discord.py bot. Here are a few suggestions:
-
Use a database to store the player information and their stats. This will allow you to easily retrieve and update the information as needed. You can use a relational database such as MySQL or PostgreSQL, or a NoSQL database such as MongoDB or Cassandra, depending on your needs.
-
Implement a background task that runs periodically to check for players with high gold and who are attackable. You can use a library such as Celery or RQ to run the task in a separate process.
-
Store the players who have high gold and are attackable in a separate table or collection in the database. This will allow you to easily retrieve the list of players to notify on Discord.
-
Use a queue to manage the players who are not attackable yet. When a player is found who has high gold but is not attackable, you can add them to a queue to be checked again later. You can use a library such as RabbitMQ or Redis to manage the queue.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.