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

aura-c

v1.0.5

Published

Installation:

Downloads

82

Readme

Setting Up

Installation:

npm i aura-c

npm i discord.js

PD:You can use javascript or typescript, but in this case i use djs v13 and typescript

After you have installed everything, the structure should be something like this:

bot
    + node_modules
    - index.ts

Main file (index.ts)

Inside the file index.ts you must require aura-c and its constructor AuraClient, this must be converted into a variable to use its two methods.

An example:

import { AuraClient } from "aura-c";
/**
 * For v13 you need to put the intents, some like this:
 * import {Intents} from 'discord.js'
 * const bot = new AuraClient({ intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS ]})
 *
 * For v12 you dont need to put the intents.
 */
const bot = new AuraClient({
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.GUILD_MEMBERS,
  ],
});
// Now you need to input the path of command handler and event handler
bot.paths(`${__dirname + "./command"}`, `${__dirname + "./events"}`); //For example, you can use path
/** 
 * Warning:
 *
 * THE PATH READ TWO DIRS, example: dir/dir/file, commands/util/ping
 * same with events: dir/dir/file, events/guildMember/guildMemberAdd
 * 
 * now you need to run
 * 
 * the first parameter its the token, and the second its the prefix
 */
bot.run('super secret token', '!').then(() =>{
    // Here you can use .then to log when the bot its online.
    console.log('im ready.')
})

How to do commands.

Ping command example:

// You need to import the Command interface for more help.
import {Command} from 'aura-c'
// Now you need to export a constant or variable

// THE NAME OF THE CONSTANT/VARIABLE MUST BE CALLED 'command'

export const command:Command = { 
    /** Here the options, by default the parameters are:
     * name:string
     * aliases: string[],
     * run (equivalence of Client, equivalence of Message, equivalence of Arguments)
    */
   name:'ping',
   aliases:[],// You can leave it blank if you don't want to use aliases, if you leave it like this: [''] the commands are likely to fail.
   run: async(client, message, args) =>{
       return message.reply(`My ping its: ${client.ws.ping}`);
   }
}

How to do a event:

messageCreate event

// You need to import the Command interface for more help.
import {Event, Command} from 'aura-c'
// Now you need to export a constant or variable

// THE NAME OF THE CONSTANT/VARIABLE MUST BE CALLED 'event'

export const event:Event = { 
    /** Here the options, by default the parameters are:
     * name:string
     * run (equivalence of Client, arguments of Event Name)
    */
   name:'messageCreate',
   run: async(client, message) =>{
       if(!message.guild || message.author.bot || !message.content.startsWith(client.prefix)) return

       const args = message.content.slice(client.prefix.length).trim().split(/ +/g),
      cmd = args.shift();
       let command = client.commands.get(cmd) || client.aliases.get(cmd) // Get commands and aliases of collection
       if(!command) return message.reply('Unknown command.')
       else (command as Command).run(client, message, args); // Here you run the command

   }
}

And ready, the structure of the bot should look something like this.

    - node_modules
    + index.ts
    - commands
        - utils
            + ping.ts
    - events
        - message
            + message.ts
    + package.json