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

bahaibot

v0.3.0

Published

A bot made for Bahá'í discourses

Downloads

9

Readme

Bahá'í Bot

npm

The Bahá'í Bot has default support for the chat server, Discord, but it could be applied for other applications, including even client-side browser-based apps.

Installation

npm i bahaibot

You can add the "9star" and "Bstar" emojis to your server to have them used by the Bot. (If you can contribute open source versions of the "awesome" emoji or our Persian new year "sabzi", we'd welcome a PR!.)

Otherwise, they will be silently ignored.

CLI Usage

You can add this command to one of your scripts in package.json:

bahaibot

CLI flags

  • --checkins - Boolean on whether to perform automated checkins
  • --locales - (Currently en-US only, the default)

Importing

For Discord usage:

import 'bahaibot';

or:

import buildBahaiBot from 'bahaibot/discordBot';

const bahaibot = buildBahaiBot({
  // ... Override default arguments
});

For non-Discord usage:

import buildBahaiBot from 'bahaibot/bot';

const bahaibot = buildBahaiBot({
  // ... Supply browser values
});

Note that for non-Discord usage, you must supply your own implementations to the API (see the API below).

For the rarer use case that one wishes an integrated client-server environment which runs in a browser context like an add-on or a web app where there is only one (trusted) user, you can use the integratedClientServerBot which has fs and getPath implementations baked in:

// If you do not want a build step, you can use this import instead:
// import buildBahaiBot from
//   './node_modules/bahaibot/dist/integratedClientServerBot.js';
import buildBahaiBot from 'bahaibot/dist/integratedClientServerBot.js';

const bahaibot = buildBahaiBot({
  // Supply implementations for:
  dialogflow,
  Discord
});

Note that this "browser" usage is not for a typical client-server architecture, but rather for more of a self-contained browser add-on or web app which used HTML/JavaScript technologies but was not necessarily interactive or managing privileges between different users on a server. The HTTP middleware which could facilitate such a bot might be added in the future.

API

buildBahaiBot({
  // Boolean whether to run checkin code
  checkins,
  // Defaults to `['en-US']` in Node and otherwise, defaults to checking
  //  `navigator.languages` for any matches with the app's locales, adding
  //  `en-US` if none are found.
  locales,

  // THESE ARE REQUIRED FOR NON-NODE IMPLEMENTATIONS (Node will auto-supply
  //  all of the following)

  fetch, // Defaults to `window.fetch` for non-Node; Node auto-supplies
  // These can either be imported as global values or supplied via a direct
  //  ESM `/node_modules` import (or build step).
  i18n, // Defaults to `window.intlDom.i18n`, assuming UMD of
  //       `intl-dom` dep. used
  striptags, // Defaults to `window.striptags`, assuming UMD of `striptags`
  //       dep. used

  Discord, // A Discord implementation
  client, // A Discord.Client implementation (defaults to `new Discord.Client`)
  dialogflow, // dialogflow implementation

  fs, // The Node `fs/promises`

  // Provided `system` value of `getPath('settings.json')` JSON; returns
  //  settings object `system.development` by default, though in Node,
  //  allowing for a `--production` flag to trigger getting `system.production`
  //  instead.
  getSettings,
  getPath // The Node equivalent of:
  //           `require('path').join(process.cwd(), path)`
  //            May be passed `settings.json` or `PROJECT_JSON` within
  //            `settings.json`

});

Settings

  • token
  • disableNotMentioned - Defaults to false
  • welcomeChannel - Defaults to 'welcome'
  • awesomeEmoji - Defaults to 'awesome'
  • helpTeam - Defaults to DiscordConstants.BAHAI_FYI_HELP_TEAM
  • rulesChannel - Defaults to DiscordConstants.BAHAI_FYI_RULES_CHANNEL_ID
  • PUPPET_AUTHOR - Defaults to DiscordConstants.USER_AB
  • ADMIN_PERMISSION - Defaults to DiscordConstants.ADMIN_PERMISSION
  • ADMIN_IDS - Defaults to DiscordConstants.ADMIN_IDS
  • ADMIN_ROLES - Defaults to DiscordConstants.ADMIN_ROLES
  • disabledCommandGroups - Defaults to []
  • enabledCommandGroups - Defaults to ['*']
  • embedColor - The color border
  • embedTextLimit - The maximum text limit
  • PROJECT_ID - dialogflow service account key (see https://cloud.google.com/dialogflow/es/docs/quick/setup#sa-create)
  • PROJECT_JSON - dialogflow service account key json file (see https://cloud.google.com/dialogflow/es/docs/quick/setup#sa-create)
  • bstarEmoji - Defaults to 'bstar'
  • checkinGuilds = Defaults to:
checkinGuilds = [
  {
    guildID: DiscordConstants.BAHAI_LAB_GUILD_ID,
    guildName: getLocalizedSetting('labServerName'),
    guildChannels: [
      {
        id: DiscordConstants.BAHAI_LAB_BOT_TESTING_CHANNEL_ID,
        greetings: getLocalizedSetting('debugCheckin', {
          defaultValue: greets.debugCheckin
        }),
        reportUptime: true
      }
    ]
  },
  {
    guildID: DiscordConstants.BAHAI_FYI_GUILD_ID,
    guildName: getLocalizedSetting('serverName'),
    guildChannels: [
      {
        id: DiscordConstants.BAHAI_FYI_GENERAL_CHANNEL_ID,
        greetings: getLocalizedSetting('fyiCheckin-general', {
          defaultValue: greets.fyiCheckin.general
        })
      },
      {
        id: DiscordConstants.BAHAI_FYI_IRC_BRIDGE_CHANNEL_ID,
        greetings: getLocalizedSetting('fyiCheckin-ircBridge', {
          defaultValue: greets.fyiCheckin.ircBridge
        })
      },
      {
        id: DiscordConstants.BAHAI_FYI_STUDY_HALL_CHANNEL_ID,
        bpToday: true
      }
    ]
  }
];

Building one's own implemenations

See implementation-notes.md.

A.I. Integration

Functions

Hidden Words

Search

Prayers

Contributing

See CONTRIBUTING.md.