Skip to content
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

Failing to get value at "ChatBadgeList.badgeSetNames". #29

Closed
nantokaworks opened this issue Mar 16, 2019 · 1 comment
Closed

Failing to get value at "ChatBadgeList.badgeSetNames". #29

nantokaworks opened this issue Mar 16, 2019 · 1 comment
Labels

Comments

@nantokaworks
Copy link

Bug Report

Cannot convert undefined or null to object error when call globalBadges.badgeSetNames.
I am immature, but tried to send PR. #28

Code

const globalBadges = await twitchClient.badges.getGlobalBadges();
globalBadges.badgeSetNames.forEach(s => {
  const badgeSet = globalBadges.getBadgeSet(s);
  badgeSet.versionNames.forEach(v => {
    const version = badgeSet.getVersion(v);
    console.debug(JSON.stringify({
      imageUrl: version.getImageUrl(1),
      desc: version.description,
      clickUrl: version.clickUrl,
      clickAction: version.clickAction,
      title: version.title,
    }));
  });
});

Expected behavior

call ChatBadgeList.badgeSetNames If normal return badge set names(string[]).

Actual Behavior

but, ChatBadgeList.badgeSetNames :

return Object.keys(this._data.versions);

Isn't it correct to return a list of badge names rather than a list of versions?

I think the structure is as follows.

{
  broadcaster: {
    versions: {
      "1": {
        title: ~~,
        description: ~~,
        ...
      }
      ...
    }
  }
  ...
}

Environment

  • Version: 2.0.0
  • Browser version: Google Chrome 72.0.3626.121
  • Operating system: OSX Mojave
@d-fischer
Copy link
Member

Fixed in ec24231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants