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

sensum

v1.3.1-1

Published

A Discord.JS Bot Framework Written in Typescript.

Downloads

29

Readme

Sensum

Sensum is a framework that aims to speed up discord bot development by offering tools that allow you to quickly create commands.

Why Sensum?

  • Object-oriented
  • Flexible
  • 100% Promise-based
  • Typescript. The auto completions will save you a lot of time.

Install

npm install sensum

or

yarn add sensum

Your first Sensum Bot

import { BotClient, defaultCommands } from 'sensum';

const bot = new BotClient({ ownerId: '12344321', prefix: '!', token: 'abc.DefGhijkLmn123', root: __dirname });

// These are optional. (eval, repeat, botInvite, help, info, ping)
defaultCommands.forEach(cmd => bot.loadCommand(cmd));

bot.login();

Examples

Simple Command

To create a command create a file that ends in .command.js or .command.ts and export a Sensum Command from it. Sensum will load them automatically.

// my-commands-folder/howdy.command.ts
import { Command } from 'sensum';

export default new Command({
  name: 'howdy',
  description: 'Greetings!',
  aliases: ['yeehaw'],
  delete: true,
  category: 'funny',
  async run(bot, message, context) {
    // Yeeeeeeeeeeeeeeeeeeeehaw! 🐄
    const msg = await message.channel.send('Yeehaw!');
    await msg.react('🤠').catch(() => {});
  },
});

Event Handlers

To create an event create a file that ends in .event.js or .event.ts and export a Sensum EventHandler from it. Sensum will load them automatically.

Bot is ready.

// my-events-folder/bot-ready.event.ts
import { EventHandler } from 'sensum';

// Here, "name" and "message" are fully typed, go nuts. ;)
export default new EventHandler({
  name: 'ready',
  enabled: true,
  run(bot, message) {
    console.log(`${bot.user.username} is ready!`);
  },
});

Someone sent a message.

// my-events-folder/message.event.ts
import { EventHandler } from 'sensum';

export default new EventHandler({
  name: 'messageCreate',
  enabled: true,
  async run(bot, message) {
    await message.react('♥');
  },
});

An error ocurred somewhere.

// my-events-folder/error-handler.event.ts
import { EventHandler } from 'sensum';

export default new EventHandler({
  name: 'error',
  enabled: true,
  run(bot, error) {
    console.log('Oh no, something bad happened!', error);
  },
});

Roadmap

  • [x] Commands
  • [x] Listeners
  • [x] Event Handlers
  • [x] Scheduled Tasks
  • [ ] Prompter
  • [ ] Slash Commands
  • [ ] Buttons, Menus and Other Interactions

Disclaimer

Currently (v1) the library is under heavy WIP therefore the current public API may change. When v2 is released the public API will be stable.