7.3.8 • Published 3 years ago

rf-bot-framework v7.3.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

rf-bot-framework

coming soon...

const BotMaster = require("rf-bot-framework");

const bot = new BotMaster({
	botName: process.env.APP_NAME,
	active: true,
	consoleChat: true,	// log messages to console
	commandPrefix: "/",	// example /command or !command
	model: "./model.json",	//nlp model
	commandsList: "./commands.json", // list of commands
	responsesList: "./responses.json", // list of responses
	discordLoggerUrl: process.env.DISCORD_LOGGER_URL,
	useCommandEmitter: false,
	useNgrok: false,
	ngrokToken: process.env.NGROK_TOKEN,
	sendRestartMessage: true,
	trainModel: true
	dbUrl: process.env.DATABASE_URL,
	dbUsername: process.env.DATABASE_USERNAME,
	dbPassword: process.env.DATABASE_PASSWORD,
	dbCollection: process.env.DATABASE_COLLECTION,
})

const botFlows = bot.flows
const botPlugins = bot.plugins
const messages = bot.messages

bot.on("message", async (context) => {

	let reply = context.reply
	let message = context.message;
	let intent = message.intent;
	let channelName = context.name;
	let userid = context.user.id;

	try {

		// bot flows
		// bot flows
		// bot flows
		// bot flows

	} catch(e) {
		console.log(e);
	};
})

bot.on("dm", async context => {

})


bot.dm("channel", {
	userid: "userid",
	message: "hello person"
})

bot.broadcast("channel", {
	subChannelid: "12345678",
	message: "hello world"
})

Context

This is the most important data.

.message message data

.user user data

.reply(message, options)

.sendPhoto(url)

.get(item)

.set(item, data)

.has(item)

.exists(item)

.clear(item)

.addToSet(array, data)

.addToList(listName, data)

.updateList(listName, data)

.findUser(username, channel, data)

User - user database schema

.Keyword - keyword database schema

.responses - responder (.get(), .has(), etc)

.loggers - loggers (.discordLogger)

Send Messages ↗️

.dm(channel, {}) direct message a user

.broadcast(channel, {}) send a message to a channel on a platform

Receive Messages ↙️

.on("message", context) any kind of message

.on("command", context) commands (must set useCommandEmitter to true)

.on("dm", context) any type of direct messages

Storage 💾

this bot uses mongoDB to store information in the backend.

It has a User schema built in. You can also add your own schemas.

Reserved Schemas

userSchema

diarySchema

channelSchema

gameSchema

listSchema

messageSchema

flowSchema

keywordSchema

Flows 🌊

One of the primary components of this bot is flows.

Flows are like individual apps or modules that can do different things.

BotRelay

const Bot = require("rf-bot-framework")
const BotRelay = Bot.BotRelay

let botRelay = new BotRelay({
	channel: "discord",
	subChannelid: process.env.SUBCHANNEL_ID,
	botUserid: process.env.BOT_USERID,
	botUsername: process.env.BOT_USERNAME,
	botToken: process.env.BOT_TOKEN
})

botRelay.start()
7.3.1

3 years ago

7.3.5

3 years ago

7.3.4

3 years ago

7.3.3

3 years ago

7.3.2

3 years ago

7.3.8

3 years ago

7.3.7

3 years ago

7.3.6

3 years ago

7.2.9

3 years ago

7.2.8

3 years ago

7.2.12

3 years ago

7.2.11

3 years ago

7.2.10

3 years ago

7.2.6

3 years ago

7.2.5

3 years ago

7.2.7

3 years ago

7.2.4

3 years ago

7.2.3

3 years ago

7.1.10

3 years ago

7.2.2

3 years ago

7.2.1

3 years ago

7.2.0

3 years ago

7.1.9

3 years ago

7.1.8

3 years ago

7.1.6

3 years ago

7.1.3

3 years ago

7.1.2

3 years ago

7.1.5

3 years ago

7.1.4

3 years ago

7.0.0

3 years ago

7.0.4

3 years ago

7.0.3

3 years ago

7.1.1

3 years ago

7.0.2

3 years ago

7.1.0

3 years ago

7.0.1

3 years ago

7.0.8

3 years ago

7.0.7

3 years ago

7.0.5

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.7

3 years ago

4.0.5

3 years ago

4.0.6

3 years ago

4.0.4

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.4

3 years ago

3.2.2

3 years ago

3.2.3

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.0.12

3 years ago

3.0.10

3 years ago

3.0.11

3 years ago

3.0.7

3 years ago

3.0.9

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.5

3 years ago

2.0.6

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago