Bot wont go online

when I try to run the script yarn dev I get this problem
Solution:
Hey @Shen (Currently Sick), The port used by the api plugin is already used so cannot connect. Try to change the port use this one 🙂...
Jump to solution
8 Replies
Solution
Swiizyy
Swiizyy•2y ago
Hey @Shen (Currently Sick), The port used by the api plugin is already used so cannot connect. Try to change the port use this one 🙂
Krish
Krish•2y ago
Port 4000 is already in use by some other program and it's a djs question, nothing related to sapphire
Swiizyy
Swiizyy•2y ago
const { OAuth2Scopes } = require('discord.js');

{
auth: {
// The application/client ID of your bot
// You can find this at https://discord.com/developers/applications
id: '',
// The client secret of your bot
// You can find this at https://discord.com/developers/applications
secret: '',
// The name of the authentication cookie
cookie: 'SAPPHIRE_AUTH',
// The URL that users should be redirected to after a successful authentication
redirect: '',
// The scopes that should be given to the authentication
scopes: [OAuth2Scopes.Identify],
// Transformers to transform the raw data from Discord to a different structure.
transformers: []
},
// The prefix for all routes, e.g. / or v1/
prefix: '',
// The origin header to be set on every request at 'Access-Control-Allow-Origin.
origin: '*',
// Any options passed to the NodeJS "net" internal server.listen function
// See https://nodejs.org/api/net.html#net_server_listen_options_callback
listenOptions: {
// The port the API will listen on
port: 4000
}
}
const { OAuth2Scopes } = require('discord.js');

{
auth: {
// The application/client ID of your bot
// You can find this at https://discord.com/developers/applications
id: '',
// The client secret of your bot
// You can find this at https://discord.com/developers/applications
secret: '',
// The name of the authentication cookie
cookie: 'SAPPHIRE_AUTH',
// The URL that users should be redirected to after a successful authentication
redirect: '',
// The scopes that should be given to the authentication
scopes: [OAuth2Scopes.Identify],
// Transformers to transform the raw data from Discord to a different structure.
transformers: []
},
// The prefix for all routes, e.g. / or v1/
prefix: '',
// The origin header to be set on every request at 'Access-Control-Allow-Origin.
origin: '*',
// Any options passed to the NodeJS "net" internal server.listen function
// See https://nodejs.org/api/net.html#net_server_listen_options_callback
listenOptions: {
// The port the API will listen on
port: 4000
}
}
If he must modify the port parameter in the listenoptions with an unused port this is part of sapphire not discord
Krish
Krish•2y ago
sapphire doesn't aquire any ports by default pepeHmm
Favna
Favna•2y ago
it does for the api plugin.
Krish
Krish•2y ago
"by default" doesn't include plugins
Ben
Ben•2y ago
The cli does pull in the api plugin so “default” kinda depends on if your using the cli or not.
Favna
Favna•2y ago
the "default" template no longer does FYI. Only the "complete" one does. For TypeScript anyway.
Want results from more Discord servers?
Add your server