feature: teams support (#3350)

* 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
This commit is contained in:
bdistin
2019-06-25 13:31:48 -05:00
committed by SpaceEEC
parent 6100aceef2
commit a22aabf6a8
6 changed files with 223 additions and 3 deletions

View File

@@ -145,6 +145,8 @@ exports.Endpoints = {
makeImageUrl(`${root}/channel-icons/${channelID}/${hash}`, { size, format }),
Splash: (guildID, hash, format = 'webp', size) =>
makeImageUrl(`${root}/splashes/${guildID}/${hash}`, { size, format }),
TeamIcon: (teamID, hash, { format = 'webp', size } = {}) =>
makeImageUrl(`${root}/team-icons/${teamID}/${hash}`, { size, format }),
};
},
invite: (root, code) => `${root}/${code}`,
@@ -569,6 +571,19 @@ exports.DefaultMessageNotifications = [
'MENTIONS',
];
/**
* The value set for a team members's membership state:
* * INVITED
* * ACCEPTED
* @typedef {string} MembershipStates
*/
exports.MembershipStates = [
// They start at 1
null,
'INVITED',
'ACCEPTED',
];
function keyMirror(arr) {
let tmp = Object.create(null);
for (const value of arr) tmp[value] = value;