Websocket not working

I am not receiving any events or even if I do it just cuts out in 5 second
21 Replies
d.js toolkit
d.js toolkit•14mo 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!
! Seferog
! SeferogOP•14mo ago
const {
Client,
Collection,
GatewayIntentBits,
Partials,
Options,
} = require("discord.js");
require("dotenv").config();
const fs = require("fs");

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});
const testMode = false;

client.commands = new Collection();

const commandFiles = fs
.readdirSync("./commands/")
.filter((file) => file.endsWith(".js"));

for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.data.name, command);
}

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", console.log);
client.on("warn", console.warn);
client.on("error", console.error);
client.on("messageCreate", async (msg) => {
console.log(msg.channel.id);
});

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);
const {
Client,
Collection,
GatewayIntentBits,
Partials,
Options,
} = require("discord.js");
require("dotenv").config();
const fs = require("fs");

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});
const testMode = false;

client.commands = new Collection();

const commandFiles = fs
.readdirSync("./commands/")
.filter((file) => file.endsWith(".js"));

for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.data.name, command);
}

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", console.log);
client.on("warn", console.warn);
client.on("error", console.error);
client.on("messageCreate", async (msg) => {
console.log(msg.channel.id);
});

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);
there code
! Seferog
! SeferogOP•14mo ago
and here it randomly cutting
No description
! Seferog
! SeferogOP•14mo ago
No description
! Seferog
! SeferogOP•14mo ago
@Qjuh I just got this working on a US server but does not work on my local + germany vps
! Seferog
! SeferogOP•14mo ago
problem seems to be this part I think
No description
! Seferog
! SeferogOP•14mo ago
when it fetches servers with success it works yeah but only on render.com yes still not working let me try again
! Seferog
! SeferogOP•14mo ago
No description
! Seferog
! SeferogOP•14mo ago
still same 🥲 can this be an IP thing? @Qjuh like discord restricted my ip from ws checking 40 seconds @Qjuh I think it sends the first beat and just destory it on second?
! Seferog
! SeferogOP•14mo ago
No description
! Seferog
! SeferogOP•14mo ago
shows something like this @Qjuh
d.js docs
d.js docs•14mo ago
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
! Seferog
! SeferogOP•14mo ago
running
! Seferog
! SeferogOP•14mo ago
No description
! Seferog
! SeferogOP•14mo ago
same @Qjuh
! Seferog
! SeferogOP•14mo ago
new npm ls discord-api-types
No description
! Seferog
! SeferogOP•14mo ago
Yeah but this happens on both my local and vps local -> based in turkey vps -> germany
! Seferog
! SeferogOP•14mo ago
No description
! Seferog
! SeferogOP•13mo ago
doubt it is a package problem was working fine 2d ago okay besides that how can I fix zombie connection @Qjuh I have network issues both on vps and my local? @Qjuh This also works on different bot tokens just on my main bot it doesnt work
! Seferog
! SeferogOP•13mo ago
No description
! Seferog
! SeferogOP•13mo ago
with test bot it is all fine
const { Client, GatewayIntentBits, Partials } = require("discord.js");

const TOKEN ="";

const go = async () => {
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
],
partials: [
Partials.Message,
// Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user?.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);

});
client.on("debug", console.log);
client.on("warn", console.warn);
client.on("error", console.error);
client.on("messageCreate", async (msg) => {
console.log(msg.channel.id);
});

await client.login(TOKEN);
};

go();
const { Client, GatewayIntentBits, Partials } = require("discord.js");

const TOKEN ="";

const go = async () => {
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
],
partials: [
Partials.Message,
// Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user?.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);

});
client.on("debug", console.log);
client.on("warn", console.warn);
client.on("error", console.error);
client.on("messageCreate", async (msg) => {
console.log(msg.channel.id);
});

await client.login(TOKEN);
};

go();
doesnt work even with this code Yes but it wasnt working wthout go function as well On any code main token gives zombie connection 303
Want results from more Discord servers?
Add your server