feat(Relationships): Change enum
This commit is contained in:
parent
821b7d0ee4
commit
97db955466
@ -126,7 +126,7 @@ class RelationshipsManager {
|
|||||||
*/
|
*/
|
||||||
cancelFriendRequest(user) {
|
cancelFriendRequest(user) {
|
||||||
const id = this.resolveId(user);
|
const id = this.resolveId(user);
|
||||||
if (this.cache.get(id) !== RelationshipTypes.OUTGOING_REQUEST) return false;
|
if (this.cache.get(id) !== RelationshipTypes.PENDING_OUTGOING) return false;
|
||||||
return this.__cancel(id);
|
return this.__cancel(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ class RelationshipsManager {
|
|||||||
// Check if already friends
|
// Check if already friends
|
||||||
if (this.cache.get(id) === RelationshipTypes.FRIEND) return false;
|
if (this.cache.get(id) === RelationshipTypes.FRIEND) return false;
|
||||||
// Check if outgoing request
|
// Check if outgoing request
|
||||||
if (this.cache.get(id) === RelationshipTypes.OUTGOING_REQUEST) return false;
|
if (this.cache.get(id) === RelationshipTypes.PENDING_OUTGOING) return false;
|
||||||
await this.client.api.users['@me'].relationships[id].put({
|
await this.client.api.users['@me'].relationships[id].put({
|
||||||
data: {
|
data: {
|
||||||
type: RelationshipTypes.FRIEND,
|
type: RelationshipTypes.FRIEND,
|
||||||
|
@ -1481,13 +1481,21 @@ exports.GuildScheduledEventPrivacyLevels = createEnum([null, null, 'GUILD_ONLY']
|
|||||||
* * 0: NONE
|
* * 0: NONE
|
||||||
* * 1: FRIEND
|
* * 1: FRIEND
|
||||||
* * 2: BLOCKED
|
* * 2: BLOCKED
|
||||||
* * 3: INCOMING_REQUEST
|
* * 3: PENDING_INCOMING
|
||||||
* * 4: OUTGOING_REQUEST
|
* * 4: PENDING_OUTGOING
|
||||||
|
* * 5: IMPLICIT
|
||||||
* @typedef {string} RelationshipTypes
|
* @typedef {string} RelationshipTypes
|
||||||
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/relationships.html}
|
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/relationships.html}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.RelationshipTypes = createEnum(['NONE', 'FRIEND', 'BLOCKED', 'INCOMING_REQUEST', 'OUTGOING_REQUEST']);
|
exports.RelationshipTypes = createEnum([
|
||||||
|
'NONE',
|
||||||
|
'FRIEND',
|
||||||
|
'BLOCKED',
|
||||||
|
'PENDING_INCOMING',
|
||||||
|
'PENDING_OUTGOING',
|
||||||
|
'IMPLICIT',
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The premium tier (Server Boost level) of a guild:
|
* The premium tier (Server Boost level) of a guild:
|
||||||
|
6
typings/enums.d.ts
vendored
6
typings/enums.d.ts
vendored
@ -29,10 +29,12 @@ export const enum NitroType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const enum RelationshipTypes {
|
export const enum RelationshipTypes {
|
||||||
|
NONE = 0,
|
||||||
FRIEND = 1,
|
FRIEND = 1,
|
||||||
BLOCKED = 2,
|
BLOCKED = 2,
|
||||||
INCOMING_REQUEST = 3,
|
PENDING_INCOMING = 3,
|
||||||
OUTGOING_REQUEST = 4,
|
PENDING_OUTGOING = 4,
|
||||||
|
IMPLICIT = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum localeSetting {
|
export const enum localeSetting {
|
||||||
|
Loading…
Reference in New Issue
Block a user