Best way to get active client from http request

Please tell me if this is absolutely crazy. From a game we're sending an http request to an express app. At that point we want to refresh discord embeds in channels. Currently, I'm setting up a client.once() and then login() and destroy(). The connection takes a bit of time and I hate to connect and disconnect each time (typically every 5 min) Does anyone else do anything like this? Is there a way i can get an active/logged in client?
3 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
duck
duck3mo ago
well it doesn't sound like you're actually using the gateway for anything, so you probably don't even need to use discord.js this could be achieved with @discordjs/core (particularly even importing API from @discordjs/core/http-only) or @discordjs/rest directly
whoneedsroads
whoneedsroads3mo ago
this is what I'm doing each time const client = await BotSetup.Once(); const guild = //Gets guild by GuildID; const baseOnDuty = new BaseOnDuty(client, guild); await Promise.all([
baseOnDuty.UpdateTransitOnDuty(transit), baseOnDuty.UpdateMedicOnDuty(medics),
]) client.destroy() await client.login(config.DISCORD_TOKEN); return client; omg i didn't even know discordjs rest was a thing that worked, thanks Duck!