PNPerson
PNPerson17mo ago

Using discord.js in Deno?

Apparently Deno supports discord.js now. Awesome. But now I can't make it work. According to debug logs, the Websocket connection is timing out. What could be happening?
11 Replies
PNPerson
PNPerson17mo ago
If I shut off my internet, nothing happens so it's on Deno's side I assume. @.bartlomieju Maybe you can help? I'll make an issue, but for now might as well ask. This is my logs:
Debug: Preparing to connect to the gateway...
Debug: [WS => Manager] Manager was destroyed. Called by:
Error
at WebSocketManager.destroy (file:///C:/Users/erisf/llm-bot/llm-bot/node_modules/.deno/discord.js@14.11.0/node_modules/discord.js/src/client/websocket/WebSocketManager.js:326:54)
at Client.destroy (file:///C:/Users/erisf/llm-bot/llm-bot/node_modules/.deno/discord.js@14.11.0/node_modules/discord.js/src/client/Client.js:251:13)
at Client.login (file:///C:/Users/erisf/llm-bot/llm-bot/node_modules/.deno/discord.js@14.11.0/node_modules/discord.js/src/client/Client.js:229:12)
at eventLoopTick (ext:core/01_core.js:197:13)
at async file:///C:/Users/erisf/llm-bot/llm-bot/basic_test.mjs:19:1
Debug: Preparing to connect to the gateway...
Debug: [WS => Manager] Manager was destroyed. Called by:
Error
at WebSocketManager.destroy (file:///C:/Users/erisf/llm-bot/llm-bot/node_modules/.deno/discord.js@14.11.0/node_modules/discord.js/src/client/websocket/WebSocketManager.js:326:54)
at Client.destroy (file:///C:/Users/erisf/llm-bot/llm-bot/node_modules/.deno/discord.js@14.11.0/node_modules/discord.js/src/client/Client.js:251:13)
at Client.login (file:///C:/Users/erisf/llm-bot/llm-bot/node_modules/.deno/discord.js@14.11.0/node_modules/discord.js/src/client/Client.js:229:12)
at eventLoopTick (ext:core/01_core.js:197:13)
at async file:///C:/Users/erisf/llm-bot/llm-bot/basic_test.mjs:19:1
My code:
import { Client, Events } from "npm:discord.js";

import { config } from "dotenv";

// Begin variable definitions

config();

const client = new Client({
intents: []
});

client.on(Events.ClientReady, () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on(Events.Debug, (message) => console.log("Debug:", message)); // Listen for debug messages

await client.login("You_Cannot_Have_My_Token"); // Yes, I pass in a valid token.
import { Client, Events } from "npm:discord.js";

import { config } from "dotenv";

// Begin variable definitions

config();

const client = new Client({
intents: []
});

client.on(Events.ClientReady, () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on(Events.Debug, (message) => console.log("Debug:", message)); // Listen for debug messages

await client.login("You_Cannot_Have_My_Token"); // Yes, I pass in a valid token.
bartlomieju
bartlomieju17mo ago
I really haven't checked myself and I got some other high priority work that I need to look into. I'm gonna defer to @crowlkats to handle this
PNPerson
PNPerson17mo ago
UPDATE: So I made a new VSCode project and it works. What The Fuck Part 1 It's happening again!
Esente
Esente17mo ago
Would you be open to give https://deno.land/x/discordeno@18.0.1 a try to see if the issue is consistent? And we might be able to narrow it down.
PNPerson
PNPerson17mo ago
A bit late for that- it seemed to be my-PC only. I've moved it to an external server and it's fine now.
Leokuma
Leokuma16mo ago
I use Discordeno. Never had a problem
PNPerson
PNPerson16mo ago
This is Discord.js on Deno which they support now
Nexus Prime
Nexus Prime16mo ago
note: npm:discord.js doesn't work on windows but it works on wsl ubuntu any status update?
crowlKats
crowlKats16mo ago
havent had the chance yet to investigate. I'll make myself a slot for the coming week to look into this
Nexus Prime
Nexus Prime16mo ago
<:cookie_deno:1002977285734932480>
PNPerson
PNPerson16mo ago
Found this is the issue. Odd? Yes.