How to handle multiple tokens.

I have a single file of code. I'd like to run a service where you send a bot token and it runs the code on that bot too. How could i handle that? discord.js@latest node.js@latest
11 Replies
d.js toolkit
d.js toolkit2d 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!
treble/luna
treble/luna2d ago
depends on how you are getting that token you cannot ask users to give you their bot token
kama
kamaOP2d ago
no. it's basically my friends whenever they create a server they need a protection bot. so they give me token and i host script on that token
treble/luna
treble/luna2d ago
just use the same bot then?
MartialAssault
You need a different bot for different servers? If you have access to these “different tokens” you can simply maintain different env files, and whenever you start the bot you can use Node’s —env-file flag to specify the env file to use while running the application
kama
kamaOP2d ago
okay yeah but the point is to use multiple tokens at once yea if for example you want go have your custom branding discord is very limited with per-server bot identity
MartialAssault
I’ve been doing this the entire time to deploy any of the bots (of course they authorised me to) Is there a way around to this?! I actually have the same “white labelling” question as @kama Makes sense O_O
kama
kamaOP2d ago
i'm not asking them. they willingly give it to me. that's why services like crowbots or myself can work around that rule i see. well my problem still resides in how to run everything on multiple tokens without duplicating my code
Amgelo
Amgelo2d ago
I mean I'd say that having a system for that is still against the ToS, it's not like "I have it but I don't recommend using it" is a strong argument maybe if you make it very, very clear that they're violating the ToS it'll be better
kama
kamaOP13h ago
yes. but i want to run them all simultaneously without having to run the code 3x
Rusty
Rusty11h ago
I guess just put all of them in for loop or something and that’s it. Run a file once to start all of them.

Did you find this page helpful?