Giter VIP home page Giter VIP logo

Comments (10)

MoosaSaadat avatar MoosaSaadat commented on June 9, 2024

When I use

bot.teams.getTeamDetails(bot.getConfig('context'));

I get the following error:

error TS2576: Property 'getTeamDetails' does not exist on type 'TeamsInfo'. Did you mean to access the static member 'TeamsInfo.getTeamDetails' instead?

from botkit.

MoosaSaadat avatar MoosaSaadat commented on June 9, 2024

@benbrown can you help here?

from botkit.

bzoel avatar bzoel commented on June 9, 2024

@MoosaSaadat I'm doing getMember to get user e-mail on 4.10.0

await bot.teams.getMember(bot.getConfig('context'), message.user);

from botkit.

MoosaSaadat avatar MoosaSaadat commented on June 9, 2024

@billyzoellers Although it works fine, I am using TypeScript and get the following error:

Property 'getMember' does not exist on type 'TeamsInfo'. Did you mean to access the static member 'TeamsInfo.getMember' instead? ts(2576)

I have to disable type check in order to compile it

// @ts-nocheck

from botkit.

MoosaSaadat avatar MoosaSaadat commented on June 9, 2024

Btw @benbrown when this issue is resolved, I can create a PR to update docs for using bot.teams.getMember() instead of bot.api.getUserById()

from botkit.

benbrown avatar benbrown commented on June 9, 2024

Hi guys.

For historical accuracy - the doc you linked to in your OP is to the previous version of Botkit, not the current 4.0 version.

Accessing the bot.teams object is what you want to do... However I am not sure how to deal with the static member warning. Disabling the type check should have no impact on the behavior...

from botkit.

MoosaSaadat avatar MoosaSaadat commented on June 9, 2024

@benbrown as per the specification of static:

Neither static methods nor static properties can be called on instances of the class

The error we are facing is also demonstrated in the first example:

class Triple {
  ...
  static calculate(n = 1) {
    return n * 3;
  }
}
...
const tp = new Triple();
...
// This throws because calculate() is a static member, not an instance member.
console.log(tp.calculate());                // 'tp.calculate is not a function'

So, in our case, access to the TeamsInfo class is required. It should be exported from botkit so that we can use it.

from botkit.

benbrown avatar benbrown commented on June 9, 2024

Can you import it directly from the botbuilder library?

https://github.com/howdyai/botkit/blob/main/packages/botkit/src/core.ts#L374

from botkit.

MoosaSaadat avatar MoosaSaadat commented on June 9, 2024

Yes, I can import it directly and it works fine like that. But, I guess it is not a standard practice to import dependencies which are not mentioned in package.json? Also, eslint will show this problem:

'botbuilder' should be listed in the project's dependencies. Run 'npm i -S botbuilder' to add it - eslint [import/no-extraneous-dependencies](https://github.com/import-js/eslint-plugin-import/blob/v2.25.4/docs/rules/no-extraneous-dependencies.md)

Is there a way to list it in dependencies without having to download multiple versions of it? Will have to make sure that the listed dependency has the same version as botkit dependency to avoid unnecessary duplication.

from botkit.

benbrown avatar benbrown commented on June 9, 2024

@MoosaSaadat Correct, you should use the same version of botbuilder as Botkit to avoid conflicts.

from botkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.