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

feature: teams support #3350

Merged
merged 10 commits into from Jun 25, 2019
Merged

feature: teams support #3350

merged 10 commits into from Jun 25, 2019

Conversation

bdistin
Copy link
Contributor

@bdistin bdistin commented Jun 19, 2019

Please describe the changes this PR makes and why it should be merged:
This adds support structures for Discord Teams. If you run Client#fetchApplication() you will now have a ClientApplication object that's owned by either a User or a Team along with all the other things the Teams data brings with it.

Note: TeamMember#permissions is likely to change in the future when proper permissions are implemented for them. I assume that property should become more like a BitField type object, but all of that data isn't available at this time as far as I am aware.

Status

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

src/structures/TeamMember.js Outdated Show resolved Hide resolved
src/structures/TeamMember.js Outdated Show resolved Hide resolved
@@ -67,9 +68,9 @@ class ClientApplication extends Base {

/**
* The owner of this OAuth application
* @type {?User}
* @type {User|Team}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Owner and Team should be separated in my opinion. While the owner of an app that is in a team is fake, it's still an user. A warning should be added instead

src/structures/Team.js Outdated Show resolved Hide resolved
src/structures/Team.js Outdated Show resolved Hide resolved
src/structures/TeamMember.js Outdated Show resolved Hide resolved
src/structures/TeamMember.js Outdated Show resolved Hide resolved
src/structures/TeamMember.js Outdated Show resolved Hide resolved
src/util/Constants.js Show resolved Hide resolved
this.user = this.client.users.add(data.user);

/**
* The ID of the Team Member
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant it. This is redundant...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamMembers are keyed by id in Team#members, the only id we have to relate to is the user id, which is no different than how GuildMembers' ids work.

I thought your original complaint is we weren't using the User instead of the raw user data, so that's why I made the change I did, which really doesn't matter which way.

Copy link
Member

@SpaceEEC SpaceEEC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typings for ClientApplication#owner need to reflect that the property can also be a Team.

@cfanoulis
Copy link
Contributor

any update on this?

@SpaceEEC
Copy link
Member

yes

@SpaceEEC SpaceEEC merged commit a22aabf into discordjs:master Jun 25, 2019
@bdistin bdistin deleted the teams branch June 25, 2019 18:39
SpaceEEC added a commit to SpaceEEC/discord.js that referenced this pull request Jun 26, 2019
SpaceEEC added a commit to SpaceEEC/discord.js that referenced this pull request Jun 26, 2019
SpaceEEC added a commit to SpaceEEC/discord.js that referenced this pull request Jun 26, 2019
SpaceEEC added a commit that referenced this pull request Jul 11, 2019
* feat(Teams): backport support for teams

PR #3350
Commit: a22aabf

* fix(TeamMember): fix name of client property

* refactor(OAuth2Application): make team nullable instead of optional

* typings(OAuth2Application): make team nullable instable of optional

* docs(OAuth2Application): deprecate and add an info to team property
samsamson33 pushed a commit to samsamson33/discord.js that referenced this pull request Feb 27, 2020
* basic teams support

* export Team & TeamMember

* use typedef

* typings and some fixes

* Update src/structures/TeamMember.js

Co-Authored-By: Vlad Frangu <kingdgrizzle@gmail.com>

* fix Team#iconURL()

* fix typings and a bug

* fix states start at 1

* team icon hash can be null

* fix owner typings
samsamson33 added a commit to samsamson33/discord.js that referenced this pull request Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants