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

helperis

v1.2.4

Published

Helper functions for eris to make your life as a developer so much easier.

Downloads

40

Readme

Helperis

A module that will help you have access to easy to use functions to help make developing bots with the Eris library a lot easier.

Eris is a library that avoids holding hands and optimizes the performance for bot developers. This can come at the slight cost of ease of use. This is where Helperis comes in to play by giving you easy to use functions.

Embeds

One key feature that is really useful for bots is sending embeds. Eris by itself makes this work through a plain old JS object. Helperis provides helper methods to help make this easier and also adds only some sanity checks to make sure your embed meets all the character limits.

const { MessageEmbed } = require('helperis')

const embed = new MessageEmbed()
	.setAuthor('Name Here', 'Icon URL Here Optional', 'Url Link here Optional')
	.setColor('#Hexcolor or RANDOM')
	.setDescription('The description you want here.')
	// Adds an inline field(columns)
	.addField('The name of the field', 'The value of the field', true)
	// Adds an field that is NOT inline. (You can skip the `false`)
	.addField('Total Members', guild.members.size.toString())
	// Adds a blank field that is inline
	.addBlankField(true)
	// Adds a blank field that is NOT inline. (You can skip the `false`)
	.addBlankField()
	// Attach a field
	.attachFile(buffer, 'filename.png')
	.setFooter('The text in the footer', 'Icon URL Here Optional')
	// This will overwrite the attachFile but this is just an example to show you all the methods available.
	.setImage('Url image here')
	// Sets the current timestamp
	.setTimestamp()
	// Set a specific timestamp
	.setTimestamp(milliseconds)
	.setTitle('The title of the embed', 'URL to open if the title is clicked OPTIONAL')
	.setThumbnail('The URL of the thumbnail')

// Since Eris accepts JSON code only, we give eris a code for this embed
return message.channel.createMessage({ embed: embed.code })

Member Functions

const { highestRole, setNickname } = require('helperis')

const highestRole = highestRole(member)

setNickname(member, 'newNick', 'Reason to set nickname')
// If you want to use multiple methods
const Helperis = require('helperis')

const highestRole = Helperis.member.highestRole(member)
const botsHighestRole = Helperis.member.highestRole(botMember)

if (highestRole.position < botsHighestRole.position) Helperis.member.setNickname(member, 'newNick', 'Reason to set nickname')

highestRole(member): Eris does not provide any easy way to figure out what the highest role of the member is. This is where this function is so useful.

userTag(memberOrUser): If you ever wanted to easily get a member or users tag username#discrim and you did not want to manually make it this helper function provides the way to give it for you.

setNickname(member, nickname, reason): An easy to use helper function to set the nickname of the bot or any member. The reason parameter is optional.

resetNickname(member, reason): An easy way to reset a member or the bots nickname. Reason is optional.