Skip to content

Commit ad24f0b

Browse files
Updated Code Comments
1 parent d355066 commit ad24f0b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

samples/bot-initiate-thread-in-channel/nodejs/bots/teamsStartNewThreadInChannel.js

+24
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ const {
88
CardFactory
99
}=require('botbuilder');
1010

11+
/**
12+
* TeamsStartNewThreadInChannel class extends TeamsActivityHandler
13+
* and provides functionality to interact with Microsoft Teams,
14+
* including listing channels, starting new threads, and retrieving team members.
15+
*/
1116
classTeamsStartNewThreadInChannelextendsTeamsActivityHandler{
1217
constructor(){
1318
super();
@@ -31,18 +36,24 @@ class TeamsStartNewThreadInChannel extends TeamsActivityHandler {
3136
});
3237
}
3338

39+
/**
40+
* Starts a new thread in the current Teams channel.
41+
* @param {TurnContext} context - The bot context.
42+
*/
3443
asyncstartNewThreadInChannel(context){
3544
try{
3645
constteamsChannelId=context.activity.channelData.channel.id;
3746
constactivity=MessageFactory.text("This will start a new thread in the channel.");
3847

48+
// Send a message to the channel and get a reference to the new thread.
3949
const[reference]=awaitTeamsInfo.sendMessageToTeamsChannel(
4050
context,
4151
activity,
4252
teamsChannelId,
4353
process.env.MicrosoftAppId
4454
);
4555

56+
// Continue the conversation in the new thread.
4657
awaitcontext.adapter.continueConversationAsync(
4758
process.env.MicrosoftAppId,
4859
reference,
@@ -56,6 +67,10 @@ class TeamsStartNewThreadInChannel extends TeamsActivityHandler {
5667
}
5768
}
5869

70+
/**
71+
* Lists all channels in the current team.
72+
* @param {TurnContext} context - The bot context.
73+
*/
5974
asynclistTeamChannels(context){
6075
try{
6176
constteamId=context.activity.channelData.team.id;
@@ -72,6 +87,7 @@ class TeamsStartNewThreadInChannel extends TeamsActivityHandler {
7287
body: [{type: "TextBlock",text: "List of Channels",weight: "Bolder",size: "Medium"}],
7388
};
7489

90+
// Add each channel name to the card.
7591
channels.forEach((channel,index)=>{
7692
cardContent.body.push({
7793
type: "TextBlock",
@@ -88,6 +104,10 @@ class TeamsStartNewThreadInChannel extends TeamsActivityHandler {
88104
}
89105
}
90106

107+
/**
108+
* Retrieves the details of the user who sent the message.
109+
* @param {TurnContext} context - The bot context.
110+
*/
91111
asyncgetTeamMember(context){
92112
try{
93113
constaadObjectId=context.activity.from.aadObjectId;
@@ -122,6 +142,10 @@ class TeamsStartNewThreadInChannel extends TeamsActivityHandler {
122142
}
123143
}
124144

145+
/**
146+
* Retrieves all team members in a paginated manner.
147+
* @param {TurnContext} context - The bot context.
148+
*/
125149
asyncgetPagedTeamMembers(context){
126150
try{
127151
constteamId=context.activity.channelData.team.id;

0 commit comments

Comments
 (0)
close