Help with Discord bot integration for mobile game automation

I built a Discord bot with discord.js and commando framework. Now I want to add a queue system where users can submit game requests.

What I want to achieve:
Users post messages in a specific channel with coordinates and item names like this:

Location needed: X: 892 Y: 445 baron

The bot should collect these requests and run my automation script one by one with 5 minute delays between each request.

Current setup:

  • Discord bot works fine for basic commands
  • Python automation script can handle the game interactions
  • I know how to execute Python from Node.js

What I need help with:
How do I make the Discord bot listen for messages in a channel, extract the coordinates and title info, then queue them for processing? I’m stuck on the message parsing and queue management part.

The Python script will use the coordinates to navigate and apply the requested title, but first I need to properly capture user inputs from Discord.

Any suggestions for handling this workflow would be great!

Database persistence saved my automation project with Discord workflows. Memory queues work fine until the server restarts and wipes everything - then you’ve got angry users asking where their requests went.

I use SQLite for local storage. Super simple setup and handles concurrent access way better than arrays. Each request gets stored with status flags: ‘pending’, ‘processing’, ‘completed’. Your bot can restart anytime without losing queue state.

For execution, I check the database every 30 seconds for pending requests instead of continuous timers. Grab the oldest pending request, mark it processing, run your Python script, update status when done. If something crashes mid-execution, you can easily reset stuck requests back to pending.

Also add request limits per user per day. Without throttling, power users flood your system and create hour-long queues that discourage everyone else.

For message parsing, set up a message event listener that filters your target channel. I use client.on('message', msg => {}) with channel ID validation so it doesn’t process messages from other channels. For the queue, skip basic arrays and make a simple queue class with push/pop methods instead. Store each request as an object with coordinates, item name, user ID, and timestamp. Makes debugging way easier when stuff breaks. The tricky bit is stopping your queue from getting stuck when Python scripts crash. I added timeout handling with setTimeout to kill processes that run too long. Also throw in a “skip” command for mods when bad requests block everything. For 5-minute delays, don’t use setInterval - use setTimeout recursively after each script finishes. Stops new requests from starting while old ones are still running. And watch out for Discord rate limits if you’re sending status updates back to users.

the parsing’s actually not that bad - it’s the user errors that’ll kill you. people constantly mess up coordinates like “x:892y:445” (no spaces) or “baron location needed x892 y445”. make your regex more flexible and validate inputs before queuing them. also throw in a per-user cooldown or someone’s gonna spam requests and wreck your 5min delay.

Queue management gets messy fast with multiple users and timing delays. I’ve dealt with similar automation workflows - managing everything in memory with arrays becomes a nightmare when your bot restarts or crashes.

For parsing messages, use simple regex like /X: (\d+) Y: (\d+) (.+)/ to grab coordinates and item names. The real challenge is reliable queue processing though.

What worked for me was moving to a proper automation platform. Instead of wrestling with Discord bot code, message parsing, queue arrays, and Python script execution in one messy setup, I use Latenode.

You can set up a webhook that receives Discord messages, parse them automatically, store requests in a database queue, and trigger your Python automation with exact timing. No more memory management or crash recovery headaches.

Best part - you can add duplicate filtering, user limits, and status updates without touching your Discord bot code. Your bot just forwards messages to the automation platform and everything runs reliably in the background.

Check it out: https://latenode.com

I tackled a similar challenge recently and found that using regex was highly effective for extracting coordinates from user messages. A pattern such as /Location needed: X: (\d+) Y: (\d+) (.+)/ can help you capture the required data accurately.

For the queuing mechanism, I simply utilized an array to store requests as they came in. Implementing setInterval to process these requests every few seconds worked well for managing execution. When it was time to run the Python script, I employed child_process.spawn to execute it, passing along the necessary parameters.

One critical thing to watch for is the possibility of overlapping requests; I learned the hard way that having a flag to manage active processes is essential. Additionally, providing users with feedback—either through message reactions or confirmation DMs—enhances their experience as they see their requests being handled. Just ensure your message listener is channel-specific and set to ignore messages from bots to prevent any unnecessary loops.