mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
refactor: resolve promises (#515)
* Adding missing await and updating some deps * Adding missing await and updating some deps * Adding missing await and updating some deps * Fix close code 4009 until deno fixes the issue: https://github.com/denoland/deno/pull/8776 * Fix heartbeating * Add await for the requestGuildMembers in requestAllMembers * Change body && body.file to body?.file * Fix lint #1 * Change body && body.file to body?.file * Fix lint * Deno lint * Update request.ts * Fix deno lint error * Update src/ws/shard_manager.ts Co-authored-by: ayntee <ayyantee@gmail.com> * Fix fetchMembers * Fix getMembersByQuery * Try to fix RequestMembersQueue processing * Deno lint * Fix requestGuildMembers * Fix requestGuildMembers * Fix requestAllMembers * Undo useless changes * Fix merge conflict * Fix merge conflict * Change for loop to Promise.all * Deno fmt Co-authored-by: ayntee <ayyantee@gmail.com> Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
@@ -314,7 +314,7 @@ export async function getMembersByQuery(
|
||||
if (!guild) return;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
requestAllMembers(guild, resolve, { query: name, limit });
|
||||
return requestAllMembers(guild, resolve, { query: name, limit });
|
||||
}) as Promise<Collection<string, Member>>;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ export function emojiURL(id: string, animated = false) {
|
||||
|
||||
/**
|
||||
* Returns a list of emojis for the given guild.
|
||||
*
|
||||
*
|
||||
* ⚠️ **If you need this, you are probably doing something wrong. Always use cache.guilds.get()?.emojis
|
||||
*/
|
||||
export async function getEmojis(guildID: string, addToCache = true) {
|
||||
@@ -411,7 +411,7 @@ export async function getEmojis(guildID: string, addToCache = true) {
|
||||
|
||||
/**
|
||||
* Returns an emoji for the given guild and emoji ID.
|
||||
*
|
||||
*
|
||||
* ⚠️ **If you need this, you are probably doing something wrong. Always use cache.guilds.get()?.emojis
|
||||
*/
|
||||
export async function getEmoji(
|
||||
@@ -586,7 +586,7 @@ export function fetchMembers(guild: Guild, options?: FetchMembersOptions) {
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
requestAllMembers(guild, resolve, options);
|
||||
return requestAllMembers(guild, resolve, options);
|
||||
}) as Promise<Collection<string, Member>>;
|
||||
}
|
||||
|
||||
@@ -953,8 +953,8 @@ export async function getTemplate(templateCode: string) {
|
||||
return template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the guild template if it exists
|
||||
/**
|
||||
* Returns the guild template if it exists
|
||||
* @deprecated will get removed in v11 use `getTemplate` instead
|
||||
*/
|
||||
export function getGuildTemplate(
|
||||
|
||||
Reference in New Issue
Block a user