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

@notedwin/autocode-discordjs

v1.0.13

Published

allows you to use Discord.js syntax with Autocode

Downloads

3

Readme

@notedwin/autocode-discordjs

API Methods

User class

const {User} = require('@notedwin/autocode-discordjs');

//DISCLAIMER: data is self defined

let user = new User(data.user)
console.log(user)
/** Output:
 * User {
 *   id: '235721297244585984',
 *   bot: false,
 *   system: false,
 *   flags: [ 'HOUSE_BALANCE', 'ACTIVE_DEVELOPER' ],
 *   username: 'Edwin',
 *   discriminator: '8437',
 *   avatar: 'ace6668e3a4d0d33ba955e2b4341d97e'
 * }
*/

//fetch basic user informations
console.log(user.fetch(user_id))

//fetch user's Discord creation time
console.log(user.createdAt);
/** Output:
 * 2016-10-12T11:12:16.753Z
 */

//fetch the Discord unix timestamp of when the user was created
console.log(user.createdTimestamp);
/** Output:
 * 1476270736
 * 
 * How to use:
 * <t:${user.createdTimestamp}:R>
 */

//The hexadecimal version of the user accent color, with a leading hash
console.log(user.hexAccentColor);

//The Discord "tag" (e.g. "Edwin#8437") for this user
console.log(user.tag)

Tools class

const {Tools} = require('@notedwin/autocode-discordjs');

//DISCLAIMER: author is self defined, no examples will be given.

tools.getUserBadges(author.public_flags)
/** Same function were used to retrieve flags in User class which can be accessed through
 * 
 * let user = new User(author)
 * 
 * console.log(user.flags);
*/

Example Usage For Autocode

HOW TO: get user's publicly displayed badges like hypesquad badge, discord moderator badge, etc.

let { User, Tools } = require('@notedwin/autocode-discordjs');

let message = context.params.event;

let user = new User(message.author);

//Method 1:
Tools.getUserBadges(user.public_flags);
//Method 2:
console.log(user.flags)

CreateChannel: ability to use this class similar like Discord.js to create new channels, set parent (category), set position (position of the channel in a category), and send message to a specific channel.

let { CreateChannel } = require('@notedwin/autocode-discordjs');

let message = context.params.event;

//channels.create(name, { guild_id, type, topic, bitrate, user_limit, rate_limit_per_user, position, permission_overwrites, parent_id, nsfw });
//bitrate and user_limit is only applicable for voice channels and stage channels.
//check out more about bitrates here by reading the * section: https://discord.com/developers/docs/resources/channel#modify-channel-json-params-guild-channel
//Check out more about channel type here: https://discord.com/developers/docs/resources/channel#channel-object-channel-types

let channel = new CreateChannel(message);

let createdChannel = await channel.create('test-channel', {
    type: 0, //for now, you will have to use the integer type from Discord Dev Portal. An alternative way is coming soon.
    topic: `channel topic here`, //optional
})

/** replace the data with the created channel's data if you wanna update the created channel's info.
 *  use the original context.params.event if you wanna update the current channel's info instead.
 */
channel = new CreateChannel(createdChannel)
await channel.setName('new-channel-name')
await channel.setParent('891309033884094525')