#Unable to login to discord boy with client.login

72 messages · Page 1 of 1 (latest)

zenith hollow
#

Tried all ways to troubleshoot it, talked with so many devs in djs-help-v14 but still unable to solve problem and told to raise a question.

tranquil mirageBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

zenith hollow
#

Node - v16.16.0

heady topaz
#

Provide your code as well please

zenith hollow
#
const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const client = new Client({
  allowedMentions: {
    parse: ["roles", "users", "everyone"],
    repliedUser: false,
  },
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildPresences,
    GatewayIntentBits.GuildMessageReactions,
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.MessageContent
  ],
  partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
});

// require('dotenv').config() // remove this line if you are using replit



require(`colors`)

const { slash, prefix } = require(`${process.cwd()}/functions/cmdErrorLogs.js`);
client.config = require(`${process.cwd()}/json/config.json`);;
client.embed = require(`${process.cwd()}/json/embed.json`);
client.emotes = require(`${process.cwd()}/json/emojis.json`);;
client.slash_err = slash;
client.msg_err = prefix;
client.prefix = client.config.SETTINGS.PREFIX;
client.slashCommands = new Collection();
client.categories = new Collection();
client.cooldowns = new Collection();
client.commands = new Collection();
client.buttons = new Collection();
client.aliases = new Collection();
client.events = new Collection();
module.exports = client;

[`extraEvents`, `server`, 'command', 'slashCommand', 'events', `antiCrash`].forEach((handler) => {
  require(`./handlers/${handler}`)(client)
});
console.log(process.env.CLIENT_ID);

client.on('debug', console.log)
  .on('warn', console.log)

client.once('ready', () => {
  console.log('Ready!');
});

client.login(process.env.TOKEN).catch((error) => { console.log((error.message).bold.red) });
#

Index.js

heady topaz
#

Cheers. Any errors or just exiting?

zenith hollow
#

i was told to put

client.on('debug', console.log)
  .on('warn', console.log)
#

issue is bot not loading

heady topaz
#

Does that log something?

zenith hollow
#

bot not coming online

#

and no ready events taking place

#

client.on ready

#

those ones

#

that's all on running bot

heady topaz
#

Let's start clean:

require('dotenv').config();

const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const client = new Client({
  allowedMentions: {
    parse: ["roles", "users", "everyone"],
    repliedUser: false,
  },
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildPresences,
    GatewayIntentBits.GuildMessageReactions,
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.MessageContent
  ],
  partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
});

client.once('ready', () => {
    console.log('Started');
});

client.login(process.env.TOKEN);

Comment out the other stuff

zenith hollow
#

ok

heady topaz
#

1 Sec. Also include ur .env. Updating code ^

zenith hollow
#

using replit

heady topaz
#

So you're unable to use dotenv?

zenith hollow
#

bot crashes

#

with new ocde

zenith hollow
#

but token loads without it

#

so no prob

heady topaz
zenith hollow
#

no error

#

and

#

nothing happens

short birch
#

try doing kill 1 in shell

zenith hollow
#

done its gone reconnecting

heady topaz
zenith hollow
zenith hollow
#

should i retry

heady topaz
#

yep

zenith hollow
#

node index.js?

heady topaz
#

🙂

zenith hollow
#

oh yes

#

bot came online

heady topaz
#

Don't go back yet to the old code, hang on

zenith hollow
#

ok

heady topaz
#

What's the reason you're using the following:

const { slash, prefix } = require(`${process.cwd()}/functions/cmdErrorLogs.js`);
client.config = require(`${process.cwd()}/json/config.json`);;
client.embed = require(`${process.cwd()}/json/embed.json`);
client.emotes = require(`${process.cwd()}/json/emojis.json`);;
client.slash_err = slash;
client.msg_err = prefix;
client.prefix = client.config.SETTINGS.PREFIX;
client.slashCommands = new Collection();
client.categories = new Collection();
client.cooldowns = new Collection();
client.commands = new Collection();
client.buttons = new Collection();
client.aliases = new Collection();
client.events = new Collection();
module.exports = client;
zenith hollow
heady topaz
#

CTRL + C in your command line?

heady topaz
#

Says whom?

zenith hollow
#

for defining

#

like

heady topaz
#

never seen it before.

zenith hollow
#

i tried and it worked

zenith hollow
#

with old code

heady topaz
#

ahh its just for terminal output?

zenith hollow
#

@heady topazdo i have to do something to close ticket?

zenith hollow
#

bot wasn't starting

heady topaz
#

but now it is

deft geyser
#

Looks like killing everything fixed it

zenith hollow
zenith hollow
heady topaz
#

I forgot how to close it, but I guess on the right top on the 3 dots and close post or something. Or archive idk

zenith hollow
#

maybe done by staffs

#

anyways thanks

zenith ibex
# zenith hollow using replit

You got ratelimited. Replit isn‘t a reliable host for discord bots because you share a host with lots of others and you call the API too much from that one host that way. Get a VPS to not get ratelimited.

zenith hollow
#

needs investment :/ and how under 18 can do that needs money

#

if i was able to buy than why i would be using repl 😂, i would be having gcp or azure or aws these are my fav services for hosting which soon i will buy