mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
Merge branch 'fp-attempt-9001' of https://github.com/Skillz4Killz/discordeno into fp-attempt-9001
This commit is contained in:
@@ -171,7 +171,7 @@ export function createExecute(cache: Cache): CacheExecutor {
|
||||
return function (type, options) {
|
||||
switch (type) {
|
||||
case "FILTER_CATEGORY_CHILDREN_CHANNELS":
|
||||
return cache.channels.filter(c => c.parentId === options.parentChannelId);
|
||||
return cache.channels.filter((c) => c.parentId === options.parentChannelId);
|
||||
case "DELETE_MESSAGES_FROM_CHANNEL":
|
||||
cache.messages.forEach((message) => {
|
||||
if (message.channelId === options.channelId) {
|
||||
|
||||
@@ -5,9 +5,5 @@ import type { Bot } from "../../bot.ts";
|
||||
export async function getIntegrations(bot: Bot, guildId: bigint) {
|
||||
await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return await bot.rest.runMethod<Integration>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_INTEGRATIONS(guildId)
|
||||
);
|
||||
return await bot.rest.runMethod<Integration>(bot.rest, "get", bot.constants.endpoints.GUILD_INTEGRATIONS(guildId));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,13 @@ import { DiscordenoChannel } from "../../../src/transformers/channel.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function cloneChannelTests(bot: Bot, guildId: bigint, channel: DiscordenoChannel, options: {reason?: string}, t: Deno.TestContext) {
|
||||
export async function cloneChannelTests(
|
||||
bot: Bot,
|
||||
guildId: bigint,
|
||||
channel: DiscordenoChannel,
|
||||
options: { reason?: string },
|
||||
t: Deno.TestContext
|
||||
) {
|
||||
const cloned = await bot.helpers.cloneChannel(channel.id, options.reason);
|
||||
|
||||
//Assertations
|
||||
|
||||
12
tests/mod.ts
12
tests/mod.ts
@@ -1,7 +1,7 @@
|
||||
import { memoryBenchmarks } from "../benchmarks/index.ts";
|
||||
import { TOKEN } from "../configs.ts";
|
||||
import {
|
||||
channelOverwriteHasPermission,
|
||||
channelOverwriteHasPermission,
|
||||
createBot,
|
||||
createEventHandlers,
|
||||
DiscordChannelTypes,
|
||||
@@ -557,19 +557,19 @@ Deno.test({
|
||||
name: "[channel] edit a channel permission overwrite",
|
||||
async fn() {
|
||||
await channelOverwriteHasPermissionTest(bot, guild.id, t);
|
||||
}
|
||||
},
|
||||
}),
|
||||
t.step({
|
||||
name: "[channel] clone a channel w/o a reason",
|
||||
async fn() {
|
||||
await cloneChannelTests(bot, guild.id, channel, {}, t);
|
||||
}
|
||||
},
|
||||
}),
|
||||
t.step({
|
||||
name: "[channel] clone a channel w/ a reason",
|
||||
async fn() {
|
||||
await cloneChannelTests(bot, guild.id, channel, { reason: "Blame wolf"}, t);
|
||||
}
|
||||
await cloneChannelTests(bot, guild.id, channel, { reason: "Blame wolf" }, t);
|
||||
},
|
||||
}),
|
||||
t.step({
|
||||
name: "[channel] delete a channel overwrite",
|
||||
@@ -587,7 +587,7 @@ Deno.test({
|
||||
name: "[channel] edit a channel w/ a reason",
|
||||
async fn() {
|
||||
await editChannelTests(bot, guild.id, { reason: "Blame wolf"}, t);
|
||||
}
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user