* Backported OAuth2Application 201ecd25a2

* Backported retry on 500 57b6980313

* Backported b8034525e3 and fa5c4efa2b
This commit is contained in:
SpaceEEC
2017-08-21 22:25:21 +02:00
committed by Crawl
parent be4ccb3686
commit f7664b01a2
14 changed files with 304 additions and 5 deletions

View File

@@ -102,7 +102,10 @@ const Endpoints = exports.Endpoints = {
relationships: `${base}/relationships`,
settings: `${base}/settings`,
Relationship: uID => `${base}/relationships/${uID}`,
Guild: guildID => `${base}/guilds/${guildID}`,
Guild: guildID => ({
toString: () => `${base}/guilds/${guildID}`,
settings: `${base}/guilds/${guildID}/settings`,
}),
Note: id => `${base}/notes/${id}`,
Mentions: (limit, roles, everyone, guildID) =>
`${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,
@@ -200,7 +203,8 @@ const Endpoints = exports.Endpoints = {
const base = `/oauth2/applications/${appID}`;
return {
toString: () => base,
reset: `${base}/reset`,
resetSecret: `${base}/reset`,
resetToken: `${base}/bot/reset`,
};
},
App: appID => `/oauth2/authorize?client_id=${appID}`,
@@ -320,6 +324,7 @@ exports.Events = {
USER_UPDATE: 'userUpdate',
USER_NOTE_UPDATE: 'userNoteUpdate',
USER_SETTINGS_UPDATE: 'clientUserSettingsUpdate',
USER_GUILD_SETTINGS_UPDATE: 'clientUserGuildSettingsUpdate',
PRESENCE_UPDATE: 'presenceUpdate',
VOICE_STATE_UPDATE: 'voiceStateUpdate',
TYPING_START: 'typingStart',
@@ -401,6 +406,7 @@ exports.WSEvents = {
USER_UPDATE: 'USER_UPDATE',
USER_NOTE_UPDATE: 'USER_NOTE_UPDATE',
USER_SETTINGS_UPDATE: 'USER_SETTINGS_UPDATE',
USER_GUILD_SETTINGS_UPDATE: 'USER_GUILD_SETTINGS_UPDATE',
PRESENCE_UPDATE: 'PRESENCE_UPDATE',
VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE',
TYPING_START: 'TYPING_START',
@@ -432,6 +438,21 @@ exports.MessageTypes = [
'GUILD_MEMBER_JOIN',
];
/**
* The type of a message notification setting. Here are the available types:
* * EVERYTHING
* * MENTIONS
* * NOTHING
* * INHERIT (only for GuildChannel)
* @typedef {string} MessageNotificationType
*/
exports.MessageNotificationTypes = [
'EVERYTHING',
'MENTIONS',
'NOTHING',
'INHERIT',
];
exports.DefaultAvatars = {
BLURPLE: '6debd47ed13483642cf09e832ed0bc1b',
GREY: '322c936a8c8be1b803cd94861bdfa868',
@@ -579,6 +600,58 @@ exports.UserSettingsMap = {
},
};
exports.UserGuildSettingsMap = {
message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching
/**
* The type of message that should notify you
* @name ClientUserGuildSettings#messageNotifications
* @type {MessageNotificationType}
*/
return exports.MessageNotificationTypes[type];
},
/**
* Whether to receive mobile push notifications
* @name ClientUserGuildSettings#mobilePush
* @type {boolean}
*/
mobile_push: 'mobilePush',
/**
* Whether the guild is muted
* @name ClientUserGuildSettings#muted
* @type {boolean}
*/
muted: 'muted',
/**
* Whether to suppress everyone mention
* @name ClientUserGuildSettings#suppressEveryone
* @type {boolean}
*/
suppress_everyone: 'suppressEveryone',
/**
* A collection containing all the channel overrides
* @name ClientUserGuildSettings#channelOverrides
* @type {Collection<ClientUserChannelOverride>}
*/
channel_overrides: 'channelOverrides',
};
exports.UserChannelOverrideMap = {
message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching
/**
* The type of message that should notify you
* @name ClientUserChannelOverride#messageNotifications
* @type {MessageNotificationType}
*/
return exports.MessageNotificationTypes[type];
},
/**
* Whether the channel is muted
* @name ClientUserChannelOverride#muted
* @type {boolean}
*/
muted: 'muted',
};
exports.Colors = {
DEFAULT: 0x000000,
AQUA: 0x1ABC9C,