feat: User#mutualFriends
This commit is contained in:
parent
ad8bed71c8
commit
6ef8970a1e
@ -178,7 +178,25 @@ class User extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check relationship status
|
* Get all mutual friends (Client -> User)
|
||||||
|
* @type {Promise<Collection<Snowflake, User>>}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get mutualFriends() {
|
||||||
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
const all = new Collection();
|
||||||
|
if (this.bot || this.client.user.id === this.id) return resolve(all);
|
||||||
|
const data = await this.client.api.users(this.id).relationships.get();
|
||||||
|
for (const u of data) {
|
||||||
|
all.set(u.id, this.client.users._add(u));
|
||||||
|
}
|
||||||
|
return resolve(all);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check relationship status (Client -> User)
|
||||||
* @type {RelationshipTypes}
|
* @type {RelationshipTypes}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -3044,6 +3044,7 @@ export class User extends PartialTextBasedChannel(Base) {
|
|||||||
public readonly premiumGuildSince: Date;
|
public readonly premiumGuildSince: Date;
|
||||||
public readonly bio: string | null;
|
public readonly bio: string | null;
|
||||||
public readonly mutualGuilds: Collection<Snowflake, object>;
|
public readonly mutualGuilds: Collection<Snowflake, object>;
|
||||||
|
public readonly mutualFriends: Promise<Collection<Snowflake, User>>;
|
||||||
public readonly voice: VoiceState;
|
public readonly voice: VoiceState;
|
||||||
public avatarURL(options?: ImageURLOptions): string | null;
|
public avatarURL(options?: ImageURLOptions): string | null;
|
||||||
public bannerURL(options?: ImageURLOptions): string | null;
|
public bannerURL(options?: ImageURLOptions): string | null;
|
||||||
|
Loading…
Reference in New Issue
Block a user