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

discord-badges

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-badges

A package that returns the badges of a Discord User

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source
Atlanta

Discord Badges

npm license

A package that returns the badges of a Discord User

How to use 📚

const badges = require("discord-badges");

badges
  .badges(user) // Get the user somehow
  .then((response) => {
    console.log(response); // log the response
  })
  .catch((e) => {
    console.log(e); // log the error (if any)
  });

Example ✏️

const Discord = require("discord.js");
const badges = require("discord-badges"); // Requiring our package.

const client = new Discord.Client({
  fetchAllMembers: true,
});

client.on("ready", async () => {
  console.log(`${client.user.tag} is online!`);
});

client.on("message", async (message) => {
  if (message.content === "!mybadges") {
    const user = client.users.cache.get(message.author.id); // Define user
    badges
      .badges(user) // Send user to the package
      .then((response) => {
        // return the user badges
        let result = "";
        for (let i = 0; i < response.length; i++) {
          result += `**${response[i].name} :** ${response[i].url}\n`;
        }
        return message.channel.send(result);
      })
      .catch((e) => {
        // if no badges return error
        console.log(e);
        return message.channel.send("You don't have any Discord Badges.");
      });
  }
});

client.login("DISCORD_BOT_TOKEN");

Creators 💖

  • Sujal Goel#7602

Keywords

FAQs

Package last updated on 30 Aug 2021

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