remove guild.channels

This commit is contained in:
Skillz
2020-11-18 00:11:22 -05:00
parent 3c97b29cbe
commit 7c8b85cde9
5 changed files with 33 additions and 20 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ import { PermissionOverwrite } from "../types/guild.ts";
import { MessageCreateOptions } from "../types/message.ts";
import { Permissions } from "../types/permission.ts";
import { endpoints } from "../utils/constants.ts";
import { botHasChannelPermissions } from "../utils/permissions.ts";
import { botHasChannelPermissions, calculateBits } from "../utils/permissions.ts";
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
export function channelOverwriteHasPermission(
@@ -455,8 +455,8 @@ export async function isChannelSynced(channelID: string) {
const parentChannel = await cacheHandlers.get("channels", channel.parentID);
if (!parentChannel) return false;
return channel.permission_overwrites?.every((overwrite) => {
const permission = parentChannel.permission_overwrites?.find((ow) =>
return channel.permissionOverwrites?.every((overwrite) => {
const permission = parentChannel.permissionOverwrites?.find((ow) =>
ow.id === overwrite.id
);
if (!permission) return false;
+2 -3
View File
@@ -54,8 +54,8 @@ export function deleteServer(guildID: string) {
}
/** Gets an array of all the channels ids that are the children of this category. */
export function categoryChildrenIDs(guild: Guild, id: string) {
return guild.channels.filter((channel) => channel.parentID === id);
export function categoryChildrenIDs(guildID: string, id: string) {
return cacheHandlers.filter("channels", (channel) => channel.parentID === id && channel.guildID === guildID);
}
/** The full URL of the icon from Discords CDN. Undefined when no icon is set. */
@@ -132,7 +132,6 @@ export async function createGuildChannel(
})) as ChannelCreatePayload;
const channel = await structures.createChannel(result);
guild.channels.set(result.id, channel);
return channel;
}