Error:This method is only valid within the scope of ms teams team
Error:This method is only valid within the scope of ms teams team
当我使用 Teamsinfo 的 getTeamChannels 和 getTeamsDetail 方法时,出现标题中提到的错误
当我使用 TeamsInfo.getMembers 时。代码运行良好。
我正在使用 msteams 发送消息,因此范围问题不应该真正出现。 getMembers 也可以正常工作。不知道为什么其他两个不
代码没有问题-
export class MyBot extends TeamsActivityHandler {
constructor() {
super();
// See https://aka.ms/about-bot-activity-message to learn more about the message and other activity types.
this.onMessage(async (turnContext, next) => {
const members = await TeamsInfo.getMembers(turnContext);
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
}
有问题的代码-
export class MyBot extends TeamsActivityHandler {
constructor() {
super();
// See https://aka.ms/about-bot-activity-message to learn more about the message and other activity types.
this.onMessage(async (turnContext, next) => {
const teamDetails = await TeamsInfo.getTeamDetails(turnContext);
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
}
任何已知问题?
版本:"botbuilder-azure": "^4.7.2",
"botbuilder": "^4.7.2"
根据上面的评论,我想我得到了答案:
"getMembers" 之所以有效,是因为在一对一聊天(只有你和机器人)中,有 "members" 个对话。但是,机器人可以参与 3 种不同类型的聊天:
1) 一个“1-1”,就像你现在
2) "group chat",例如,您、一个或多个其他用户与机器人之间的直接聊天(这也会出现在 Teams 左侧菜单的 "chat" 部分)
3) Teams 中 "Team" 内的 "channel"。例如,您可能有一个像 "Finance" 这样的团队和一个像 "Accounts receivable" 这样的 "channel",并且您的机器人可以连接到这个团队+频道
您调用的方法取决于机器人对话发生的位置。例如,"getTeamDetails" 仅适用于上述场景 (3),其中机器人实际上 在 一个团队中。
希望对解释有所帮助?
当我使用 Teamsinfo 的 getTeamChannels 和 getTeamsDetail 方法时,出现标题中提到的错误 当我使用 TeamsInfo.getMembers 时。代码运行良好。
我正在使用 msteams 发送消息,因此范围问题不应该真正出现。 getMembers 也可以正常工作。不知道为什么其他两个不
代码没有问题-
export class MyBot extends TeamsActivityHandler {
constructor() {
super();
// See https://aka.ms/about-bot-activity-message to learn more about the message and other activity types.
this.onMessage(async (turnContext, next) => {
const members = await TeamsInfo.getMembers(turnContext);
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
}
有问题的代码-
export class MyBot extends TeamsActivityHandler {
constructor() {
super();
// See https://aka.ms/about-bot-activity-message to learn more about the message and other activity types.
this.onMessage(async (turnContext, next) => {
const teamDetails = await TeamsInfo.getTeamDetails(turnContext);
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
}
任何已知问题? 版本:"botbuilder-azure": "^4.7.2", "botbuilder": "^4.7.2"
根据上面的评论,我想我得到了答案:
"getMembers" 之所以有效,是因为在一对一聊天(只有你和机器人)中,有 "members" 个对话。但是,机器人可以参与 3 种不同类型的聊天:
1) 一个“1-1”,就像你现在 2) "group chat",例如,您、一个或多个其他用户与机器人之间的直接聊天(这也会出现在 Teams 左侧菜单的 "chat" 部分) 3) Teams 中 "Team" 内的 "channel"。例如,您可能有一个像 "Finance" 这样的团队和一个像 "Accounts receivable" 这样的 "channel",并且您的机器人可以连接到这个团队+频道
您调用的方法取决于机器人对话发生的位置。例如,"getTeamDetails" 仅适用于上述场景 (3),其中机器人实际上 在 一个团队中。
希望对解释有所帮助?