1.2.0 • Published 2 years ago

dbotlinkgen v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Bot Link Generator

Generate an invite link to your Discord bot directly on your code.

NodeJS NPM TypeScript

Installation

# NPM
$ npm install dbotlinkgen

# Yarn
$ yarn add dbotlinkgen

Usage

// import { BotURL } from "dbotlinkgen";
const { BotURL } = require("dbotlinkgen");

const url = new BotURL()
    .setClient("942780735876628581")
    // .setScopes("bot") - Add "single" scope
    .setScopes(["bot", "applicationsCommands"]) // Add "multiple" scopes
    // .setGuild("942782748899307580") - Prefill a guild in the select menu
    // .disableSelect(true) - Disable the guild select menu
    // .addPermission("VIEW_CHANNEL") - Add permission one by one
    .addPermissions(["VIEW_CHANNEL", "SEND_MESSAGES"]); // Add multiple permissions

    if (!url.hasPermission("MANAGE_GUILD")) {
        url.addPermission("MANAGE_GUILD");
    }; // You can check and add permission as well

console.log(url.create()); // Create the url by using ".create()" method

Reference

const { BotURL } = require("dbotlinkgen");

const url = new BotURL()
    .setClient("942780735876628581")
    .setScopes(["bot", "applicationsCommands"])
    .setGuild("942782748899307580")
    .disableSelect(false)
    .addPermission("VIEW_CHANNEL")
    .addPermissions(["SEND_MESSAGES", "CREATE_INSTANT_INVITE"]);

    if (!url.hasPermission("VIEW_CHANNEL")) url.addPermission("VIEW_CHANNEL");

console.log(url.create());

License

MIT