feat(Guild): topEmojis

This commit is contained in:
Elysia 2023-02-21 19:01:26 +07:00
parent dc477b353e
commit d5b2b62a44
2 changed files with 21 additions and 0 deletions

View File

@ -1684,6 +1684,26 @@ class Guild extends AnonymousGuild {
}; };
} }
/**
* Get the top emojis of this guild.
* @returns {Promise<Collection<number, GuildEmoji>>}
*/
topEmojis() {
return new Promise((resolve, reject) => {
this.client.api
.guilds(this.id)
['top-emojis'].get()
.then(data => {
const emojis = new Collection();
for (const emoji of data.items) {
emojis.set(emoji.emoji_rank, this.emojis.cache.get(emoji.emoji_id));
}
resolve(emojis);
})
.catch(reject);
});
}
/** /**
* Creates a collection of this guild's roles, sorted by their position and ids. * Creates a collection of this guild's roles, sorted by their position and ids.
* @returns {Collection<Snowflake, Role>} * @returns {Collection<Snowflake, Role>}

1
typings/index.d.ts vendored
View File

@ -1340,6 +1340,7 @@ export class Guild extends AnonymousGuild {
private _sortedChannels(channel: NonThreadGuildBasedChannel): Collection<Snowflake, NonThreadGuildBasedChannel>; private _sortedChannels(channel: NonThreadGuildBasedChannel): Collection<Snowflake, NonThreadGuildBasedChannel>;
public readonly afkChannel: VoiceChannel | null; public readonly afkChannel: VoiceChannel | null;
public topEmojis(): Promise<Collection<number, Emoji>>;
public afkChannelId: Snowflake | null; public afkChannelId: Snowflake | null;
public afkTimeout: number; public afkTimeout: number;
public applicationId: Snowflake | null; public applicationId: Snowflake | null;