Rasor
Rasor
DIAdiscord.js - Imagine an app
Created by Rasor on 9/16/2023 in #djs-questions
Awaiting component interactions in Discord.js and optimization concerns when scaling up
Hey! I have a concern regarding awaiting components when serving a large amount of users. I am building a bot that is a currency/banking system aimed at RPG guilds or any other that, well, needs a currency system that allows users to transfer to/trade with each other. One required step is to "open an account" with the "Bank" (bot). For that some setting up is required and, since I need select menus, buttons, and text inputs, I cannot simply use a modal. In this multistep sign up process, awaiting components is perfect, since I only need one function that acts as a pipeline for the entire process. However, my concern is: that function exists in the bot's process while it is awaiting. If my bot is awaiting a ton of users, how bad and how fast can it get? EDIT: I know I can set a timeout, but even so... What I've been doing before is split this functionality in several functions and, for every time the user interacts with a component, instead of await that component interaction I simply call the function for that specific interaction. User clicked on the "I agree", bot client receives the button interaction with signup-btn-i-agree and calls userClickedIAgreeShowThemOkMessage(). Can I await components even in large scale usage? If my post is too confusing, please let me know and I'll rephrase or clarify whatever's not understandable. Thanks in advance. Have a great weekend!
7 replies