简体   繁体   English

错误:此方法仅在msteams团队范围内有效

[英]Error:This method is only valid within the scope of ms teams team

I get an error as mentioned in the title when i use Teamsinfo's getTeamChannels and getTeamsDetail methods where as when i use TeamsInfo.getMembers.当我使用 Teamsinfo 的 getTeamChannels 和 getTeamsDetail 方法时,我收到标题中提到的错误,而当我使用 TeamsInfo.getMembers 时。 The code works fine perfectly.代码完美运行。

im using msteams to send messages hence the scope issue shouldnt really come up.我使用 msteams 发送消息,因此范围问题不应该真正出现。 Also getMembers works totally fine. getMembers 也完全正常。 not sure why the other two doesn't不知道为什么另外两个没有

Code without issue-没有问题的代码-

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();
        });
    }
}

Code with issue-有问题的代码-

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();
        });
    }
}

Any known issue?任何已知问题? Versions:"botbuilder-azure": "^4.7.2", "botbuilder": "^4.7.2"版本:“botbuilder-azure”:“^4.7.2”,“botbuilder”:“^4.7.2”

Based on the comments above, I think I've got an answer:根据上面的评论,我想我有一个答案:

"getMembers" is working because, in a 1-1 chat (just you and the bot), there are "members" of the conversation. “getMembers”之所以有效,是因为在一对一聊天中(只有您和机器人),对话中有“成员”。 However, there are 3 different kinds of chats a bot can participate in:但是,机器人可以参与 3 种不同类型的聊天:

1) a "1-1", like you're having now 2) a "group chat", where there's a direct chat between, for example, you, one or more other users, and the bot (this will also appear in the "chat" section on the left menu in Teams) 3) A "channel" inside a "Team" in Teams. 1) 一个“1-1”,就像你现在有的 2) 一个“群聊”,例如,你、一个或多个其他用户和机器人之间的直接聊天(这也会出现在团队左侧菜单上的“聊天”部分)3)团队中“团队”内的“频道”。 For instance, you might have a team like "Finance" with a "channel" like "Accounts receivable", and your bot can be connected to this team+channel例如,你可能有一个像“财务”这样的团队,有一个像“应收账款”这样的“频道”,你的机器人可以连接到这个团队+频道

The methods you're calling depend on where the bot conversation is taking place.您调用的方法取决于机器人对话发生的位置。 For instance, "getTeamDetails" will only work in scenario (3) above, where the bot is actually in a team.例如,“getTeamDetails”仅适用于上述场景 (3),其中机器人实际上一个团队中。

Hope that helps explain?希望这有助于解释?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 MS Teams 中安装 bot 时获取所有团队成员 - Get all team members when bot is installed in MS Teams 向 MS Teams 发送主动消息时出错 - Error while sending proactive message to MS Teams MS Teams 机器人上下文或功能中是否有租户名称的概念? - Is there a notion of a tenant name within an MS Teams bot context or function? 微软团队 | Microsoft bot 框架 - 在任务/获取时返回 502 错误 - MS Teams | Microsoft bot framework - Returns 502 error on task/fetch Web自动化转到下一页-调用在await块内返回Promise的方法)-await仅在异步中有效 - Web Automation to go to the next page - Invoking method that returns Promise within await block) - await is only valid in async 使用 Team 的附件按钮在机器人应用程序中上传文件时,Microsoft Teams 返回错误 - Microsoft Teams returning error when file is uploaded in bot application using Team's attachment button 错误:当函数已经在异步函数中时,等待仅在异步函数中有效 - Error: await is only valid in async function when function is already within an async function 访问 ms 团队活动源 - Accessing ms teams activity feed 面临错误:对于使用 Bot Framework SDK 构建的 MS Teams Bot,此机器人不支持文件附件 - Facing Error: File attachments aren’t supported for this bot for MS Teams Bot built using Bot Framework SDK await 仅在异步 function 错误中有效 - await is only valid in async function error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM