-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify the TS command bot template #7257
base: dev
Are you sure you want to change the base?
Simplify the TS command bot template #7257
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## dev #7257 +/- ##
=======================================
Coverage 76.69% 76.69%
=======================================
Files 578 578
Lines 39361 39361
Branches 7694 7694
=======================================
Hits 30186 30186
Misses 5934 5934
Partials 3241 3241 |
c686440
to
c0770c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this new simplified structure.
Removing the folders makes it less opinionated leaving the structure up to the developer to decide what is best for them and without having to unpick an existing folder structure.
It would be nice to implement an empty TeamsActivityHandler in index.ts
as well to make it easier for developers to implement handlers for Teams events where there are no TeamsFx abstractions.
// teams activity handler setup, override methods to handle incoming activities from Teams
class ConversationBotActitivityHandler extends TeamsActivityHandler {
constructor() {
super();
}
}
// create an instance of your activity handler
const conversationBotActitivityHandler = new ConversationBotActitivityHandler();
// bot framework endpoint to receive incoming activities
server.post("/api/messages", async (req, res) => {
await conversationBot.adapter.process(req, res, (context) => conversationBotActitivityHandler.run(context))
});
title: "Your Hello World Bot is Running", | ||
body: "Congratulations! Your hello world bot is running. Click the documentation below to learn more about Bots and the Teams Toolkit.", | ||
// An example Adaptive Card that defines the response message of this helloWorld command. | ||
const cardJson = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider keeping this as an external file rather than bringing it inline.
You lose the context that there is a card definition from briefly looking at the project structure and also lose the ability to view the card in the Adaptive Cards Designer VSCode extension.
A simplification of the command bot template and make it easier to get started and understand. This also cleans up some language to try and make things clearer.
Some shortcuts were taken to reduce the number of files and concepts introduced so that it's simpler for developers to understand where to start/explore first. i.e.
index.ts
contains code for the restify server and the command bot configuration instead of using separate files and naming like "internal" - which weren't very clear on their intent.The result in the scaffold: