abdulrahman1s / better-revolt.js Goto Github PK
View Code? Open in Web Editor NEWA NodeJS Revolt library
Home Page: https://abdulrahman1s.github.io/better-revolt.js/
License: Apache License 2.0
A NodeJS Revolt library
Home Page: https://abdulrahman1s.github.io/better-revolt.js/
License: Apache License 2.0
Here's the output error.
(node:22451) UnhandledPromiseRejectionWarning: ReferenceError
at REST.request (/home/user/Desktop/devs/js/revoltbot/node_modules/better-revolt-js/dist/rest/REST.js:40:23)
at REST.request (/home/user/Desktop/devs/js/revoltbot/node_modules/better-revolt-js/dist/rest/REST.js:43:25)
at REST.request (/home/user/Desktop/devs/js/revoltbot/node_modules/better-revolt-js/dist/rest/REST.js:43:25)
at REST.request (/home/user/Desktop/devs/js/revoltbot/node_modules/better-revolt-js/dist/rest/REST.js:43:25)
at REST.get (/home/user/Desktop/devs/js/revoltbot/node_modules/better-revolt-js/dist/rest/REST.js:66:21)
at Client.login (/home/user/Desktop/devs/js/revoltbot/node_modules/better-revolt-js/dist/client/Client.js:28:45)
at Object.<anonymous> (/home/user/Desktop/devs/js/revoltbot/src/index.js:5:8)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
at processPromiseRejections (internal/process/promises.js:247:11)
at processTicksAndRejections (internal/process/task_queues.js:96:32)
and I have no idea how to fix it because there's no documentation or wiki.
OS: Linux
Node.js: v14.17.5
better-revolt.js: v0.1.0-beta
Upon starting the application, a Unprocessable Entity error emits:
/root/root/Revolt/node_modules/better-revolt-js/dist/rest/REST.js:63
throw new HTTPError_1.HTTPError(res.statusText, res.constructor.name, res.status, request);
^
Response: Unprocessable Entity
at REST.request (/root/root/Revolt/node_modules/better-revolt-js/dist/rest/REST.js:63:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Client.login (/root/root/Revolt/node_modules/better-revolt-js/dist/client/Client.js:40:28) {
code: 422,
method: 'POST',
path: 'https://api.revolt.chat/auth/login',
info: { retries: 0, body: {} }
}
And the code was:
const { Client } = require('better-revolt.js')
const client = new Client()
client.login({token: process,env.token})
client.on('ready', () => {
console.log('Connected')
console.log(client.user.username)
})
client.on('message', msg => {
if (msg.content === '!ping') {
msg.reply('Pong!')
}
})
Since your library uses user authentication, you need to update certain routes. (revoltchat/backend#63)
Revolt's user authentication flow has been overhauled, changes include:
x-user-id
header.Documentation is available here: https://developers.revolt.chat/api/#tag/Account
Would be better to emit partial messages rather than only emitting the cached message.
It would be nice to have a Revolt library that is compatible with Deno. I already submitted an issue on the official JavaScript library, but let's also try and get this one working. There are two ways we can go about it: SkyPack or native.
SkyPack is a CDN meant to convert CommonJS modules to ESM. Currently, you could use this for Deno compatibility but this loses the typings, because SkyPack isn't seeing the typings file. Fortunately, the fix is easy; define the typings file in package.json, under a typings field
This would take significantly more work but it would mean that we are able to use the same library on Deno and Node.JS, without relying on a CDN. Since Deno could also natively run TypeScript files, it would mean significantly less work for publication and updating.
There are two major things that one would have to consider before changing our repo:
Every static import would have to be changed to a dynamic one with the following code: import('<file path>' + ("Deno" in (window || {}) ? '.ts' : ''))
Also, while Node.js relies on a node_modules folder, Deno could import modules from anywhere. This means that the above problems would exist on every module we use as a dependency. It's probably best to start from the end (aka this library) and work our way up to the dependencies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.