This commit is contained in:
ITOH
2021-04-09 21:37:13 +02:00
parent 577010e953
commit 9312606100
26 changed files with 233 additions and 13 deletions
+5
View File
@@ -1,3 +1,4 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
@@ -19,6 +20,10 @@ export async function createChannel(
const requiredPerms: Set<PermissionStrings> = new Set(["MANAGE_CHANNELS"]);
options?.permissionOverwrites?.forEach((overwrite) => {
eventHandlers.debug(
"loop",
`Running forEach loop in create_channel file.`,
);
overwrite.allow.forEach(requiredPerms.add, requiredPerms);
overwrite.deny.forEach(requiredPerms.add, requiredPerms);
});
+12 -1
View File
@@ -1,3 +1,4 @@
import { eventHandlers } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ModifyChannel } from "../../types/channels/modify_channel.ts";
import { endpoints } from "../../util/constants.ts";
@@ -77,6 +78,10 @@ function processEditChannelQueue() {
const now = Date.now();
editChannelNameTopicQueue.forEach((request) => {
eventHandlers.debug(
"loop",
`Running forEach loop in edit_channel file.`,
);
if (now > request.timestamp) return;
// 10 minutes have passed so we can reset this channel again
if (!request.items.length) {
@@ -96,7 +101,13 @@ function processEditChannelQueue() {
});
if (editChannelNameTopicQueue.size) {
setTimeout(() => processEditChannelQueue(), 600000);
setTimeout(() => {
eventHandlers.debug(
"loop",
`Running setTimeout in EDIT_CHANNEL file.`,
);
processEditChannelQueue();
}, 600000);
} else {
editChannelProcessing = false;
}