
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
botbuilder-botbldr
Advanced tools
Get up and running quickly with BotBuilder v4 with bot classes that add features to context
and hide the messy plumbing.
You can use predefine classes for console and service bots, or bake your own.
This is an experimental project subject to change without notice. Use at your own risk. Not an officially supported Microsoft product.
npm install --save botbuilder-botbldr
Here's an echobot using the predefined ConsoleBot
:
import { ConsoleBot } from 'botbuilder-botbldr';
const bot = new ConsoleBot();
bot.onTurn(async context => {
context.conversationState.count = context.conversationState.count === undefined ? 0 : context.conversationState.count + 1;
await context.sendActivity(`${context.conversationState.count}: You said "${context.request.text}"`);
});
Swap out ConsoleBot
for ServiceBot
to test your bot with Emulator then run it in the cloud in the Azure Bot Service.
Both use an extended version of BotContext
called StateContext
which adds .conversationState
and .userState
properties to context
. Any changes you make to either of these are automatically persisted at the end of each turn. By default they use MemoryStorage
as a state storage provider, but you can pass in any you like, e.g.
const bot = new ConsoleBot(new FileStorage("path_to_your_file"));
If you use TypeScript you can define types for these properties:
import { ConsoleBot } from 'botbuilder-botbldr';
interface MyConversationState {
count: number;
}
interface MyUserState {
name: string;
}
const bot = new ConsoleBot<MyConversationState, MyUserState>();
bot.onTurn(async context => {
context.conversationState.count = context.conversationState.count === undefined ? 0 : context.conversationState.count + 1;
await context.sendActivity(`${context.conversationState.count}: You said "${context.request.text}"`);
});
context
(or I want to extend it more)No problem, you can make your own extended context following the recipe used in /src/StateContext.ts. Then extend BaseBot
following the recipe used in /src/StateBot.ts and /src/ConsoleBot.ts
Sure, just add:
bot.use(new BestMiddlewareEver())
before your call to bot.onRequest
Yes!
const calledBySomeEventSomewhere = async (activity: Activity) => {
await bot.continueConversation(activity, async context => {
await context.sendActivity(`Something happened!`);
});
}
FAQs
Simple starters for botbuilder
The npm package botbuilder-botbldr receives a total of 0 weekly downloads. As such, botbuilder-botbldr popularity was classified as not popular.
We found that botbuilder-botbldr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.