refactor: resolve async promises, fixed typos, and used inline variable for return (#299)

* Added await in async function, fixed typos and used inline variable for return

* Added await in async function, fixed typos and used inline variable for return

* Revert "Added await in async function, fixed typos and used inline variable for return"

This reverts commit f31caf5d

* Added await in async function, fixed typos and used inline variable for return

* Fixes format

* Fixes format 2

* Fixes format 4475757

* Fixes format 878757854786312378657865785785785785

* Change return to await

* Fixing more issues

* Fixing even more issues

* Fixing even more issues +

* Fixes format
This commit is contained in:
TriForMine
2020-12-30 09:31:11 +01:00
committed by GitHub
parent 6d7aa35d9c
commit 484f86638f
29 changed files with 126 additions and 141 deletions
+8 -11
View File
@@ -22,7 +22,7 @@ import {
calculateBits,
} from "../../util/permissions.ts";
import { cacheHandlers } from "../controllers/cache.ts";
import { structures } from "../structures/structures.ts";
import { structures } from "../structures/mod.ts";
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
export function channelOverwriteHasPermission(
@@ -38,8 +38,8 @@ export function channelOverwriteHasPermission(
if (overwrite) {
const allowBits = overwrite.allow;
const denyBits = overwrite.deny;
if (BigInt(denyBits) & BigInt(Permissions[perm])) return false;
if (BigInt(allowBits) & BigInt(Permissions[perm])) return true;
if (BigInt(denyBits) && BigInt(Permissions[perm])) return false;
if (BigInt(allowBits) && BigInt(Permissions[perm])) return true;
}
return false;
});
@@ -303,7 +303,9 @@ export async function getChannelWebhooks(channelID: string) {
) {
throw new Error(Errors.MISSING_MANAGE_WEBHOOKS);
}
return RequestManager.get(endpoints.CHANNEL_WEBHOOKS(channelID)) as Promise<
return await RequestManager.get(
endpoints.CHANNEL_WEBHOOKS(channelID),
) as Promise<
WebhookPayload[]
>;
}
@@ -461,12 +463,7 @@ export async function isChannelSynced(channelID: string) {
ow.id === overwrite.id
);
if (!permission) return false;
if (
overwrite.allow !== permission.allow || overwrite.deny !== permission.deny
) {
return false;
}
return true;
return !(overwrite.allow !== permission.allow ||
overwrite.deny !== permission.deny);
});
}