npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

discord-multipurpose

v2.1.14

Published

A simple package to help in your discord.js needs!

Downloads

50

Readme

Discord Multipurpose

This is a package to help make development of Discord.js bots easier. Also has Type Declarations!

Installation

$npm i discord-multipurpose@latest

That should install the package to your project

Modules & Usage

  • Discord Emoji

const Multipurpose = require("discord-multipurpose");

console.log(Multipurpose.DiscordEmoji.food.apple);
// Logs "🍎"
  • Discord Image Manipulation

    • ⚠ You need canvas installed to use these functions, discord.js is not required for these. If you are on Windows and have never used canvas previously, you will probably need to install windows-build-tools using npm i -g windows-build-tools along with GTK-2 & Python. Refer to this for further information ⚠

    • Methods

      • ping:

        • Draws a Discord ping across the user's image
        • Parameters:
          • avatar (Type: string | Buffer, Required: true): The avatar of the user
      • fakeReply:

        • Draws a fake reply yk
        • Parameters:
          • avatar1 (Type: string | Buffer, Required: true): The avatar of the user who is replying
          • avatar2 (Type: string | Buffer, Required: true): The avatar of the user being replied to
          • username1 (Type: string, Required: true): The nickname/username of the user who is replying
          • username2 (Type: string, Required: true): The nickname/username of the user who is being replied to
          • messageText (Type: string, Required: true): The content of the sent message
          • replyText (Type: string, Required: true): The content of the replied message
          • hex1 (Type: string, Required: false): The colour of the role of the replying user
          • hex2 (Type: string, Required: false): The colour of the role of the replying user
          • mode (Type: string, Options: 'light', 'dark', Required: false, default: dark): The mode you want the stuff to be displayed in
      • invert:

        • Inverts the Image colours
        • Parameters:
          • avatar (Type: string | Buffer): The image, whose colours you want to invert
      • sepia:

        • Applies Sepia effect on to the image
        • Parameters:
          • avatar (Type: string | Buffer): The image on which you want to apply the effect/filter
      • greyscale:

        • Applies greyscale filter on the image
        • Parameters:
          • avatar (Type: string | Buffer): The image on which you want to apply the filter
      • blur:

        • Blurs an Image
        • Parameters:
          • avatar (Type: string | Buffer): The image which you want to blur
      • drip:

        • Drip, do I need to explain further? 😎
        • Parameters:
          • avatar (Type: string | Buffer): The image which will be Drip's face replacement
    • Example

      const Multipurpose = require("discord-multipurpose");
      const Discord = require("discord.js");
      
      const client = new Discord.Client();
      
      client.on("ready", () => console.log(`Logged in as ${client.user.tag}!`));
      
      client.on("message", async (message) => {
      	if(message.author.bot) return;
      
      	if(message.content.toLowerCase() === ">ping") {
      		const ping = await Multipurpose.Image.ping(message.author.displayAvatarURL({ format: 'png' }));
      		return message.channel.send(new MessageAttachment(ping, "ping.png"));
      	}
      });
  • Discord Util

    • Works only for Discord.js bots, you need it installed to use these methods
    • Methods
      • paginateEmbed:

        • Paginate your Embeds using reactions!

        • Parameters

          • msg (Type: Message, required: true): The message object, which you get from the Message Event
          • pages (Type: MessageEmbed[], required: true) :An array of MessageEmbeds, which you want to be in list
          • emojiList (Type: string[]): An array of left & right arrows, emojiList[0] is left arrow & emojiList[1] is the right arrow. Default: ["⏪", "⏩"]
          • timeout (Type: number): The time for which the pagination will be active (in miliseconds) Default: 120000ms (2 minutes)
        • ⚠ The following example is only there to show how it works, you need to code the commands, you can check the code of the concerned command here. You only get the reaction menu feature.

      • confirmation:

        • Get the confirmation from the user on an action
        • Parameters
          • msg (Type: Message, required: true): The message which you want to be reacted upon
          • author (Type: User, required: true): The user whose confirmation is needed
          • validReactions (Type: string[], required: false, length: 2): The emojis for yes and no. validReactions[0] has to be the one for yes & validReactions[1] has to be the one for no Default: ["✔", "❌"]
          • time (Type: number, required: false): The time for which you want to wait for the reactions (in miliseconds) Default: 60000ms (1 minute)
          • defaultResponse (Type: boolean, required: false): The result which you want to get if the user does not respond. Default: false
        • ⚠ The following example shows an implementation of a command which works on using this function
  • Minigames

    • This feature is only for Discord.js Bots
    • Subclasses
      • Akinator
        • Constructor: ( message -> Type: Message, required: true, region -> Type: Region, required: false, you'll see the options in the intellisense 🤫, default: "en" )
        • start method starts the Minigame
        • ⚠ Requires Embed Links permission to run, and there are instances when Aki-API might send errors, so it is suggested that you put it in a try catch block.

Post Script

ℹ️ Contact me at SpiderBro#8604

Feel free to make an issue or a PR in the GitHub Repository

Credits to Dr. Time™ & Conqueror for contributing!