D
Deno

help

Using discord.js in Deno?

PPNPerson6/17/2023
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? 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.
Bbartlomieju6/17/2023
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
PPNPerson6/18/2023
UPDATE: So I made a new VSCode project and it works. What The Fuck Part 1 It's happening again!
EEsente6/18/2023
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.
PPNPerson6/18/2023
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.
LLeokuma6/20/2023
I use Discordeno. Never had a problem
PPNPerson6/20/2023
This is Discord.js on Deno which they support now
N</Nexus_Prime>6/25/2023
note: npm:discord.js doesn't work on windows but it works on wsl ubuntu any status update?
CcrowlKats6/26/2023
havent had the chance yet to investigate. I'll make myself a slot for the coming week to look into this
N</Nexus_Prime>6/27/2023
<:cookie_deno:1002977285734932480>
PPNPerson6/29/2023
Found this is the issue. Odd? Yes.

Looking for more? Join the community!

Recommended Posts
Type alias with inherited type parameter constraintsIs there any way to do this? I want SVLTN to just be a short-name alias for SomeVeryLongTypeName, anFresh: global stateIs it possible to have a global state that can be accessed from anywhere? Currently I'm passing the Run Deno on Linux without /proc mountedI have a few automatic scripts using deno to run stuff, and wanted to migrate them to another MachinRunning deno in distroless image does not work wellHey, I have the following Dockerfile: ```dockerfile FROM node:lts AS build WORKDIR /app COPY .npmrcReasons to choose Node.jsI've been tasked to write a list of pros/cons of Deno in comparison to Node.js. I am quite honestly Reejs not working on Deno v1.34```js deno run -A npm:reejs [INFO] Saving important data... [TIP] If the error indeno.land published the same GitHub tag twicehttps://deno.land/x/smee_client_unofficial@v1.2.3 Could someone please just delete the older one?Uncaught (in promise) eof for websocket/root/.pm2/logs/twitter-follow-checker-error.log last 15 lines: 0|twitter_ | Deno hangs on errorWhy does Deno hang when XML.parse throws an error? ``` let text = '<xml><xbrli:xbrl><hi>Hello</hi><[SOLVED] deno.lock keeps getting populated with dependencies I don't needI have tried to use a syntax highlighter before and have since removed it from my project, but everyWhat a method prefixed with `#` means?This is perhaps the stupidest question ever. But I often see method with names prefixed with a `#`Logger names and prefixesIs there any obvious way on how to configure std/log so that loggers named `my-prefix/foo/bar` and `Deno and `npm:mongodb` problem with `node:`?``` ❯ deno check --reload main.ts error: Relative import path "net" not prefixed with / or ./ or ../DiscordJS "Error: Not implemented: ClientRequest.options.createConnection"```ts import { GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags, Client } froUsing Superagent in Deno?Has anyone managed to make Superagent work nicely in Deno? ``` _ { type: "error", message: "BroOak – ctx.assert with custom response headersAm I doing this wrong? No extra custom headers are being set in the response as far as I can see in npm:undici doesn't workhttps://github.com/denoland/deno/issues/16710 Marked as resolved by this issue but does not work in Abusing prototype CryptoKey in `node:crypto`Is there any way that I can set the prototype of an object to specifically `CryptoKey` as defined byUncaught (in promise) TypeError: cannot read headers: request closedWhat is this? How to fix it?Async OP that returns value instead of promiseIn `deno_runtime` is possible to have async op that returns the resolved value instead of promise? K