Table of contents
About
A simple Node.js package to use with discord.js to see if a user is subscribed to Discord Nitro!
Installation
- Node.js 12.0.0 or newer is required.
- discord.js is required.
npm install discord-premium-utils
Importing
CommonJS
const PremiumUtils = require("discord-premium-utils");
// OR
const { hasNitro, probablyHasNitro, isBoosting } = require("discord-premium-utils");
ES6
import PremiumUtils from "discord-premium-utils";
// OR
import { hasNitro, probablyHasNitro, isBoosting } from "discord-premium-utils";
Example
import { Client } from "discord.js";
import { hasNitro, probablyHasNitro, isBoosting } from "discord-premium-utils";
const client = new Client();
client.on("ready", () => {
console.log("Client is logged in!");
});
client.on("message", message => {
if (message.content === "!checknitro") {
if (hasNitro(message.author)) {
message.channel.send("You have nitro!");
} else if (probablyHasNitro(message.author)) {
message.channel.send("You probably have nitro!");
} else {
message.channel.send("You probably don't have nitro!");
}
}
if (message.content === "!checkboosting") {
if (isBoosting(message.author)) {
message.channel.send("You are server boosting!");
} else {
message.channel.send("You are probably not server boosting!");
}
}
});
client.login("token");