ruqqus-js v4.1.3
Table of Contents
About
ruqqus-js is a Node.js module and wrapper of the Ruqqus API.
- Designed for Ruqqus Applications
- Object-oriented
- Efficient, optimized
- Ever-adapting to the Ruqqus API
Setup
Installation
To install the NPM package: npm i ruqqus-js
Requires Node.js v12.0.0 or newer.
Creating a Ruqqus Application
If you do not have an authorized Ruqqus Application already, you must submit an API Key Request form in the apps tab of Ruqqus settings. Keep in mind that approval is not guaranteed and it could take up to a day for the Ruqqus admins to approve your request.
Acquiring an Authcode
Once you have your Application ID and client secret, you will need to acquire an authentication code ("authcode" for short). This will let the package automatically grant to the OAuth2 endpoint and retrieve an access token.
To acquire an authcode, you will need to generate a Ruqqus OAuth2 URL.
Manual URL Generation
Start with https://ruqqus.com/oauth/authorize
and add the following URL parameters:
client_id
- Your application's Client IDredirect_uri
- The redirect URI (or one of the URIs) specified in your application information. Must not use HTTP unless using localhost (use HTTPS - instead).state
- This is your own anti-cross-site-forgery token. Ruqqus doesn't do anything with this, except give it to the user to pass back to you later. You are responsible for generating and validating the state token.scope
- A comma-separated list of permission scopes that you are requesting. Valid scopes are:identity
,create
,read
,update
,delete
,vote
, andguildmaster
.permanent
- optional. Set totrue
if you are requesting indefinite access. Omit if not.
Automatic URL Generation
ruqqus-js provides two functions for automatically generating an OAuth2 URL: getAuthURL()
, which takes parameters in the function arguments, and getAuthURLInput()
, which takes the parameters in the console. Below is an example of the former.
const { getAuthURL } = require("ruqqus-js");
console.log(getAuthURL({
id: "CLIENT_ID",
redirect: "REDIRECT_URI",
state: "STATE_TOKEN",
scopes: "SCOPE_LIST",
permanent: true
}));
Completing the Setup
If you did everything correctly, the URL should take you to an Authorization page, which should subsequently take you to your specified redirect URI. The authcode should be in the URL; keep in mind that every code has a one-time use. Follow the code in the example section with the client parameters to run your bot.
Example
const Ruqqus = require("ruqqus-js");
const client = new Ruqqus.Client();
client.on("ready", () => {
console.log(`Logged in as ${client.user.username}!`);
});
client.login({
id: "CLIENT_ID",
token: "CLIENT_SECRET",
code: "AUTHCODE"
});
Links
Developer Links
Contributing
Please check if an issue has already been reported or suggested before creating a new one. Make sure to also review the documentation. Feel free to open a Pull Request if you find something noteworthy enough to change.
Most of the discussion regarding support/suggestions happens on the Ruqqus API Discord Server, so don't hesitate to join if you have any questions.
License
MIT © 2020 Kyle Prince, Panjkrc
As of February 22, 2021, acikek is no longer a maintainer of the project.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago