Bahá'í Bot
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({
});
For non-Discord usage:
import buildBahaiBot from 'bahaibot/bot';
const bahaibot = buildBahaiBot({
});
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:
import buildBahaiBot from 'bahaibot/dist/integratedClientServerBot.js';
const bahaibot = buildBahaiBot({
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({
checkins,
locales,
fetch,
i18n,
striptags,
Discord,
client,
dialogflow,
fs,
getSettings,
getPath
});
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 borderembedTextLimit
- The maximum text limitPROJECT_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.