Registration Request on Startup
I've asked AI as well and for some reason my bot just isn't launching properly. I'm not sure if it's related to discord.js but I'm learning so I might just be stupid.
Below is my debug from the console output
[DEBUG] Initializing Discord REST client...
[DEBUG] Connecting to MongoDB...
Connected to MongoDB
[DEBUG] Loading commands...
[DEBUG] Loading commands from: /home/container/commands
[DEBUG] Found command files: aea.js, probationList.js, profile.js, recruit.js, stafftickets.js, training.js
[DEBUG] Loading command file: aea.js
[DEBUG] Registering command: aea
Successfully loaded command: aea
[DEBUG] Loading command file: probationList.js
[DEBUG] Registering command: probation
Successfully loaded command: probation
[DEBUG] Loading command file: profile.js
[DEBUG] Registering command: profile
Successfully loaded command: profile
[DEBUG] Loading command file: recruit.js
[DEBUG] Registering command: recruit
Successfully loaded command: recruit
[DEBUG] Loading command file: stafftickets.js
[DEBUG] Registering command: ticket
Successfully loaded command: ticket
[DEBUG] Loading command file: training.js
[DEBUG] Registering command: training
Successfully loaded command: training
[DEBUG] Loaded 6 commands. Preparing for Discord registration...
[DEBUG] Using Client ID: [redacted]
[DEBUG] Using Guild ID: [redeacted]
[DEBUG] Testing Discord API connection...
[DEBUG] Discord API test successful
[DEBUG] Beginning command registration...
[DEBUG] Starting command registration process...
[DEBUG] Preparing command registration payload...
[DEBUG] Command data being sent: ["aea","probation","profile","recruit","ticket","training"]
[DEBUG] Sending registration request to Discord...
53 Replies
- 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!Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Well that's the thing, I'm not 100% sure.
The bot launched fine a day or two ago, then I added a few commands and updated the index.js, and now it just isn't launching properly.
[DEBUG] Sending registration request to Discord...
it just gets stuck here, when it's fully launched it's meant to say 'Logged into 13th MEU#XXXX' but it doesn't, and my new commands arent registering properly, specifically my promote.js
I'm not sure if it's an issue with my index.js or my promote.jsIf you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn more
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
- Note: if you initialize your Client as bot
or other identifiers you need to use these instead of client
- If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebinPut this into my index.js, still getting the same output no changes
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
I added it under my first few lines, still the same output
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
This output in the console when the bot starts
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Where is that output ? Apologies, I'm trying to teach myself all of this lmao
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Oh well yeah thats what im saying... The console output is the same, it doesnt display anything different
it is
This is the full console output on startup
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
I don't understand why it wouldnt be though
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Is this referencing just within index.js or more-so in every file (commands, models, utils etc)
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Alright 1 sec
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
It's functional for all my previous commands, but for the new one promote.js , it just isn't showing up
And the reason I thought it was related to index.js is because before (and still) it's meant to send the output Logged in As 13th MEU#xxxx but it doesn't and the last output is it trying to register a request with discord
But yes, when i launch it, everything else works except the new command, just a bit confused so I thought I'd ask here
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Well the index.js registers them so yeah i guess?
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Shit... so maybe I'm just being rate limited by discord then?
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Ok so like a /register command that pushes the registration through?
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Same lol
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
How would that script work, would it pretty much be the same as what I have in my index.js? I haven't touched scripts in package.json worried I'd mess it up lmao
Thanks, and yes I have. Now that I'm looking though the bot isnt actually starting
Let me remove the registration sequence and update it as a script and see if that fixes it
@sïř.jõ 🌈 I don't have a config.json, do i need to add one?
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
gotcha
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
No you're all good, let me do this script and remove the registration from index.js and ill see if that allows the bot to launch properly, i have restarted the BOT A LOT so it couldnt legimately just be rate limitting
So do i just put this script below into the 'scripts' section of package.json ? Its saying to create a deploy-commands.js , so which one do i do?
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Ok thank you ill give it a shot after i eat
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
if you've already setup your entire logic to register commands on start, you could add an if check for an env variable, like REGISTER_COMMANDS or something
or some command line variable
that's what I personally do, specially helps if you have user-configured commands
@sïř.jõ 🌈 The bot launches fine now 🙂
Only thing is, when i type 'npm run deploy' in the console it doesnt do anything
are you running this in a separate terminal?
Wdym? I'm just using the normal console
yeah thats doing nothing since your bot is running
You run that file on your local host
Since you only run it when you edit your commands
I think I understand but please explain cause I'm still learning lmao
You run the file on your computer, not on your host
How would that update the commands on the host though?