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

wolf.js

v2.6.2

Published

An unofficial Node.js API for WOLF (AKA Palringo).

Downloads

232

Readme

Introduction

WOLF.js is a community maintained javascript library used to create Unofficial Bots

Required

Optional Packages

  • ioredis - npm i ioredis
    • Requires a local or remote redis server

Getting Started

Config - './config/default.yaml'

keyword: keyword # keyword #single word only
framework:
  developer: #your id here
  language: en #default response language here
  login:
    email: # bot email here
    password: # bot password here
    onlineState: 1 # online state here
  command:
    ignore:
      official: true # whether or not an official bot will trigger a command (internal)
      unofficial: true # whether or not an unofficial bot will trigger a command (internal)
      self: true  # whether or not the bot will process its own messages and trigger its own commands (internal)
  message:
    ignore:
      self: true # whether or not the bot will process its own messages (internal)
  subscriptions:
    messages:
      channel:
        enabled: true #subscribe to channel messages  (server)
        tipping: true # subscribe to channel message tip events  (server)
      private:
        enabled: true # subscribe to private messages (server)
        tipping: false  # subscribe to private message tip events  (server) - NOT IMPLEMENTED


Phrases - './phrases/en.json'

[
    {
        "name": "{keyword}_command_{keyword}",
        "comment":"{keyword} must match the keyword specified in config yaml",
        "value":"!{keyword}"
    },

    {
        "name": "{keyword}_command_help",
        "value":"help"
    },
    {
        "name": "{keyword}_help_message",
        "value":"Welcome to the {botname} bot\n\n!{keyword} help - To display this message\n!{keyword} me - Display basic information about your profile"
    },

    {
        "name": "{keyword}_command_me",
        "value":"me"
    },
    {
        "name": "{keyword}_subscriber_message",
        "value":"Nickname: {nickname} (ID: {id})\nStatus Message: {status}\nLevel: {level} ({percentage}% completed)"
    }
]

index.js


import { WOLF, Command } from 'wolf.js';
import me from './src/me/index.js';

const client = new WOLF();
const keyword = client.config.keyword;

client.commandHandler.register(
    [
        new Command(`${keyword}_command_${keyword}`, { both: async (command) =>  command.reply(command.getPhrase(`${keyword}_help_message`)) },
            [
                new Command(`${keyword}_command_help`, { both: (command) => command.reply(command.getPhrase(`${keyword}_help_message`)) }),
                new Command(`${keyword}_command_me`, { both: (command) => me(client, command) })
            ]
        )
    ]
);

client.on('channelMessage', async (message) => {
    if (message.body !== '!ping') { return false; };

    return await message.reply('Pong!');
});

client.on('privateMessage', async (message) => {
    if (message.isCommand) { return false; }

    const { language } = await client.subscriber.getById(message.sourceSubscriberId);

    return await message.reply(client.phrase.getByLanguageAndName(language, `${client.config.keyword}_help_message`))
});

client.on('ready', () => {
    console.log('Ready');
});

client.login();

Command - './src/me/index.js'

/**
 * Required for intellisense to work with client & command
 * @param {import('wolf.js').WOLF} client
 * @param {import('wolf.js').CommandContext} command
 */
export default async (client, command) => {

    const subscriber = await client.subscriber.getById(command.sourceSubscriberId);

    return await command.reply(
        client.utility.string.replace(
            command.getPhrase(`${client.config.keyword}_subscriber_message`),
            {
                nickname: subscriber.nickname,
                id: subscriber.id,
                status: subscriber.status,
                level: subscriber.reputation.split('.')[0],
                percentage: subscriber.percentage,
            }
        )
    );
};

Approval

Bots MUST be approved by WOLF staff in bot approval or bot approval.ar

Known Issues

  • Nothing at all ᴺᵒᵗʰᶦⁿᵍ ᵃᵗ ᵃˡˡ

Lacking Features

  • Nothing at all ᴺᵒᵗʰᶦⁿᵍ ᵃᵗ ᵃˡˡ

Contact