mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix: tests with latest cache
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
import { ChannelTypes, CreateGuildChannel, OverwriteTypes } from "../../mod.ts";
|
||||
import { CACHED_COMMUNITY_GUILD_ID } from "../constants.ts";
|
||||
import { assertExists, assertEquals } from "../deps.ts";
|
||||
import { bot, guild } from "../mod.ts";
|
||||
import { delayUntil } from "../utils.ts";
|
||||
|
||||
async function createChannelTests(guildId: bigint, options: CreateGuildChannel, autoDelete: boolean) {
|
||||
const channel = await bot.helpers.createChannel(guildId, options);
|
||||
|
||||
// Assertions
|
||||
assertExists(channel);
|
||||
assertEquals(channel.type, options.type || ChannelTypes.GuildText);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => bot.channels.has(channel.id));
|
||||
|
||||
if (!bot.channels.has(channel.id)) {
|
||||
throw new Error("The channel seemed to be created but it was not cached.");
|
||||
}
|
||||
|
||||
if (options.topic && channel.topic !== options.topic) {
|
||||
throw new Error("The channel was supposed to have a topic but it does not appear to be the same topic.");
|
||||
}
|
||||
|
||||
if (options.bitrate && channel.bitrate !== options.bitrate) {
|
||||
throw new Error("The channel was supposed to have a bitrate but it does not appear to be the same bitrate.");
|
||||
}
|
||||
|
||||
if (options.permissionOverwrites && channel.permissionOverwrites?.length !== options.permissionOverwrites.length) {
|
||||
throw new Error(
|
||||
"The channel was supposed to have a permissionOverwrites but it does not appear to be the same permissionOverwrites."
|
||||
);
|
||||
}
|
||||
|
||||
if (autoDelete) {
|
||||
await bot.helpers.deleteChannel(channel.id);
|
||||
}
|
||||
}
|
||||
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(guild.id, { name: "Discordeno-test" }, false);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new category channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildCategory,
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new news channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
CACHED_COMMUNITY_GUILD_ID,
|
||||
{ name: "Discordeno-test", type: ChannelTypes.GuildNews },
|
||||
true
|
||||
);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new voice channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildVoice,
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new voice channel with a bitrate",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
guild.id,
|
||||
{
|
||||
name: "discordeno-test",
|
||||
type: ChannelTypes.GuildVoice,
|
||||
bitrate: 32000,
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new voice channel with a user limit",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildVoice,
|
||||
userLimit: 32,
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel with a rate limit per user",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
rateLimitPerUser: 2423,
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel with NSFW",
|
||||
async fn(t) {
|
||||
await createChannelTests(guild.id, { name: "Discordeno-test", nsfw: true }, false);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel with permission overwrites",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bot.id,
|
||||
type: OverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import { bot, guild } from "../mod.ts";
|
||||
import { delayUntil } from "../utils.ts";
|
||||
|
||||
async function deleteChannelTests(guildId: bigint, options: { reason?: string }) {
|
||||
// Create the necessary channels
|
||||
const channel = await bot.helpers.createChannel(guildId, {
|
||||
name: "delete-channel",
|
||||
});
|
||||
|
||||
await delayUntil(10000, () => bot.channels.has(channel.id));
|
||||
// Make sure the channel was created.
|
||||
if (!bot.channels.has(channel.id)) {
|
||||
throw new Error("The channel should have been created but it is not in the cache.");
|
||||
}
|
||||
|
||||
// Delete the channel now without a reason
|
||||
await bot.helpers.deleteChannel(channel.id, options.reason);
|
||||
// wait to give it time for event
|
||||
await delayUntil(10000, () => !bot.channels.has(channel.id));
|
||||
|
||||
// Make sure it is gone from cache
|
||||
if (bot.channels.has(channel.id)) {
|
||||
throw new Error("The channel should have been deleted but it is still in cache.");
|
||||
}
|
||||
}
|
||||
|
||||
Deno.test({
|
||||
name: "[channel] delete a channel with a reason",
|
||||
async fn(t) {
|
||||
await deleteChannelTests(guild.id, {
|
||||
reason: "with a reason",
|
||||
});
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] delete a channel without a reason",
|
||||
async fn(t) {
|
||||
await deleteChannelTests(guild.id, {});
|
||||
},
|
||||
});
|
||||
+1
-1
@@ -9,5 +9,5 @@ export const sanitizeMode = {
|
||||
|
||||
// USED FOR ROLE CHANGE EVENTS
|
||||
export const roleChanges = new Map<bigint, bigint[]>();
|
||||
|
||||
export const banCounters = new Map<bigint, boolean>();
|
||||
export const reactionCounters = new Map<bigint, number>();
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ export {
|
||||
assertThrows,
|
||||
assertThrowsAsync
|
||||
} from "https://deno.land/std@0.115.1/testing/asserts.ts";
|
||||
export * from "https://deno.land/x/discordeno_cache_plugin@0.0.11/mod.ts";
|
||||
export * from "https://deno.land/x/discordeno_cache_plugin@0.0.13/mod.ts";
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { assertEquals } from "../deps.ts";
|
||||
import { bot, guild } from "../mod.ts";
|
||||
|
||||
Deno.test({
|
||||
name: "[guild] format a guild's icon url",
|
||||
fn: () => {
|
||||
assertEquals(bot.helpers.guildIconURL(guild.id, { icon: guild.icon }), undefined);
|
||||
assertEquals(
|
||||
bot.helpers.guildIconURL(785384884197392384n, {
|
||||
icon: 3837424427068676005442449262648382018748n,
|
||||
}),
|
||||
"https://cdn.discordapp.com/icons/785384884197392384/46f50fb412eab14ec455d5cf777154bc.jpg?size=128"
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[guild] format a guild's banner url",
|
||||
fn: () => {
|
||||
assertEquals(bot.helpers.guildBannerURL(guild.id, { banner: guild.banner }), undefined);
|
||||
assertEquals(
|
||||
bot.helpers.guildBannerURL(613425648685547541n, {
|
||||
banner: 3919584870146358272366452115178209474142n,
|
||||
}),
|
||||
"https://cdn.discordapp.com/banners/613425648685547541/84c4964c115c128fb9100952c3b4f65e.jpg?size=128"
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[guild] format a guild's splash url",
|
||||
fn: () => {
|
||||
assertEquals(bot.helpers.guildSplashURL(guild.id, { splash: guild.splash }), undefined);
|
||||
assertEquals(
|
||||
bot.helpers.guildSplashURL(785384884197392384n, {
|
||||
splash: 3837424427068676005442449262648382018748n,
|
||||
}),
|
||||
"https://cdn.discordapp.com/splashes/785384884197392384/46f50fb412eab14ec455d5cf777154bc.jpg?size=128"
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { ChannelTypes } from "../../../src/types/channels/channelTypes.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function categoryChildrenTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function categoryChildrenTest(guildId: bigint) {
|
||||
const category = await bot.helpers.createChannel(guildId, {
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildCategory,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Bot, createChannel, ChannelTypes, channelOverwriteHasPermission, OverwriteTypes } from "../../../mod.ts";
|
||||
import { ChannelTypes, channelOverwriteHasPermission, OverwriteTypes } from "../../../mod.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function channelOverwriteHasPermissionTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function channelOverwriteHasPermissionTest(guildId: bigint) {
|
||||
const channel = await bot.helpers.createChannel(guildId, {
|
||||
name: "Discordeno-test",
|
||||
permissionOverwrites: [
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { DiscordenoChannel } from "../../../src/transformers/channel.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { bot, channel } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function cloneChannelTests(
|
||||
bot: Bot,
|
||||
guildId: bigint,
|
||||
channel: DiscordenoChannel,
|
||||
options: { reason?: string },
|
||||
t: Deno.TestContext
|
||||
) {
|
||||
// @ts-ignore for itoh
|
||||
const cloned = await bot.helpers.cloneChannel(channel, options.reason);
|
||||
|
||||
//Assertations
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { CreateGuildChannel } from "../../../src/types/guilds/createGuildChannel.ts";
|
||||
import { ChannelTypes } from "../../../src/types/mod.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function createChannelTests(
|
||||
bot: Bot,
|
||||
guildId: bigint,
|
||||
options: CreateGuildChannel,
|
||||
autoDelete: boolean,
|
||||
t: Deno.TestContext
|
||||
) {
|
||||
const channel = await bot.helpers.createChannel(guildId, options);
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { Channel } from "../../../src/types/channels/channel.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../../src/types/util.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function deleteChannelTests(bot: Bot, guildId: bigint, options: { reason?: string }, t: Deno.TestContext) {
|
||||
export async function deleteChannelTests(guildId: bigint, options: { reason?: string }) {
|
||||
// Create the necessary channels
|
||||
const channel = await bot.helpers.createChannel(guildId, {
|
||||
name: "delete-channel",
|
||||
@@ -15,12 +13,11 @@ export async function deleteChannelTests(bot: Bot, guildId: bigint, options: { r
|
||||
throw new Error("The channel should have been created but it is not in the cache.");
|
||||
}
|
||||
|
||||
const CHANNEL_DELETE = bot.handlers.CHANNEL_DELETE;
|
||||
|
||||
// Delete the channel now without a reason
|
||||
await bot.helpers.deleteChannel(channel.id, options.reason);
|
||||
// wait to give it time for event
|
||||
await delayUntil(10000, () => !bot.channels.has(channel.id));
|
||||
|
||||
// Make sure it is gone from cache
|
||||
if (bot.channels.has(channel.id)) {
|
||||
throw new Error("The channel should have been deleted but it is still in cache.");
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Bot, ChannelTypes, channelOverwriteHasPermission, OverwriteTypes } from "../../../mod.ts";
|
||||
import { ChannelTypes, channelOverwriteHasPermission, OverwriteTypes } from "../../../mod.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function deleteChannelOverwriteTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function deleteChannelOverwriteTests(guildId: bigint) {
|
||||
const channel = await bot.helpers.createChannel(guildId, {
|
||||
name: "Discordeno-test",
|
||||
permissionOverwrites: [
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function editChannelTests(bot: Bot, guildId: bigint, options: { reason?: string }, t: Deno.TestContext) {
|
||||
export async function editChannelTests(guildId: bigint, options: { reason?: string }) {
|
||||
// Create the necessary channels
|
||||
const channel = await bot.helpers.createChannel(guildId, {
|
||||
name: "edit-channel",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function createEmojiTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function createEmojiTest(guildId: bigint) {
|
||||
const emoji = await bot.helpers.createEmoji(guildId, {
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
|
||||
@@ -28,10 +28,10 @@ export async function ifItFailsBlameWolf(bot: Bot, guildId: bigint, reason?: str
|
||||
// }
|
||||
}
|
||||
|
||||
export async function deleteEmojiWithReasonTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function deleteEmojiWithReasonTest(guildId: bigint) {
|
||||
await ifItFailsBlameWolf(bot, guildId);
|
||||
}
|
||||
|
||||
export async function deleteEmojiWithoutReasonTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function deleteEmojiWithoutReasonTest(guildId: bigint) {
|
||||
await ifItFailsBlameWolf(bot, guildId, "with a reason");
|
||||
}
|
||||
|
||||
@@ -2,6 +2,4 @@ import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function editEmojiTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
|
||||
}
|
||||
export async function editEmojiTest(guildId: bigint) {}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function getEmojiTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getEmojiTest(guildId: bigint) {
|
||||
const emoji = await bot.helpers.createEmoji(guildId, {
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function getEmojisTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getEmojisTest(guildId: bigint) {
|
||||
const emoji = await bot.helpers.createEmoji(guildId, {
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { CreateGuildChannel } from "../../../src/types/guilds/createGuildChannel.ts";
|
||||
import { ChannelTypes } from "../../../src/types/mod.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function createGuildTests(bot: Bot, t: Deno.TestContext) {
|
||||
export async function createGuildTests() {
|
||||
const guild = await bot.helpers.createGuild({
|
||||
name: "Isekai Maid Fake Server",
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function deleteGuildTests(bot: Bot, t: Deno.TestContext) {
|
||||
export async function deleteGuildTests() {
|
||||
const guild = await bot.helpers.createGuild({
|
||||
name: "Isekai Maid Fake Server",
|
||||
});
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
export async function editGuildTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function editGuildTests(guildId: bigint) {
|
||||
const guild = await bot.helpers.editGuild(
|
||||
guildId,
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
export async function getAuditLogsTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getAuditLogsTests(guildId: bigint) {
|
||||
const logs = await bot.helpers.getAuditLogs(guildId);
|
||||
|
||||
// Assertions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
export async function getAvailableVoiceRegionsTests(bot: Bot, t: Deno.TestContext) {
|
||||
export async function getAvailableVoiceRegionsTests() {
|
||||
const regions = await bot.helpers.getAvailableVoiceRegions();
|
||||
|
||||
// Assertions
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
export async function getBanTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getBanTests(guildId: bigint) {
|
||||
await bot.helpers.banMember(guildId, 379643682984296448n);
|
||||
|
||||
const fetchedBan = await bot.helpers.getBan(guildId, 379643682984296448n);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { CreateGuildChannel } from "../../../src/types/guilds/createGuildChannel.ts";
|
||||
import { ChannelTypes } from "../../../src/types/mod.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
import { getAvailableVoiceRegions } from "../../../src/helpers/guilds/getAvailableVoiceRegions.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
export async function getBansTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getBansTests(guildId: bigint) {
|
||||
await bot.helpers.banMember(guildId, 416477607966670869n);
|
||||
await bot.helpers.banMember(guildId, 635383782576357407n);
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
export async function getGuildTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getGuildTests(guildId: bigint) {
|
||||
const fetchedGuild = await bot.helpers.getGuild(guildId);
|
||||
|
||||
// Assertions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists, assertEquals } from "../../deps.ts";
|
||||
|
||||
export async function getVanityURLTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getVanityURLTests(guildId: bigint) {
|
||||
// TODO: VANITY IS BROKEN ATM FROM DISCORDS SIDE
|
||||
return;
|
||||
// const fetchedVanityURL = await bot.helpers.getVanityURL(guildId);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Bot } from "../../../../src/bot.ts";
|
||||
import { ScheduledEventEntityType, ScheduledEventPrivacyLevel } from "../../../../src/types/guilds/scheduledEvents.ts";
|
||||
|
||||
export async function deleteScheduledEventTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
|
||||
}
|
||||
export async function deleteScheduledEventTests(guildId: bigint) {}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Bot } from "../../../../src/bot.ts";
|
||||
import { ChannelTypes } from "../../../../src/types/channels/channelTypes.ts";
|
||||
import { CreateScheduledEvent, ScheduledEventEntityType, ScheduledEventPrivacyLevel } from "../../../../src/types/guilds/scheduledEvents.ts";
|
||||
import {
|
||||
ScheduledEventEntityType,
|
||||
ScheduledEventPrivacyLevel,
|
||||
} from "../../../../src/types/guilds/scheduledEvents.ts";
|
||||
import { assertEquals } from "../../../deps.ts";
|
||||
import { bot } from "../../../mod.ts";
|
||||
|
||||
export async function editScheduledEventTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function editScheduledEventTests(guildId: bigint) {
|
||||
const channel = await bot.helpers.createChannel(guildId, {
|
||||
name: "entity",
|
||||
type: ChannelTypes.GuildStageVoice,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
|
||||
export async function createInviteTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function createInviteTest(channelId: bigint) {
|
||||
const invite = await bot.helpers.createInvite(channelId, {
|
||||
maxAge: 86400,
|
||||
maxUses: 0,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
|
||||
export async function deleteInviteTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function deleteInviteTest(channelId: bigint) {
|
||||
const invite = await bot.helpers.createInvite(channelId, {
|
||||
maxAge: 86400,
|
||||
maxUses: 0,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
|
||||
export async function getChannelInvitesTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function getChannelInvitesTest(channelId: bigint) {
|
||||
const invite = await bot.helpers.createInvite(channelId, {
|
||||
maxAge: 86400,
|
||||
maxUses: 0,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals, assertExists } from "../../deps.ts";
|
||||
|
||||
export async function getInviteTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function getInviteTest(channelId: bigint) {
|
||||
const invite = await bot.helpers.createInvite(channelId, {
|
||||
maxAge: 86400,
|
||||
maxUses: 0,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
|
||||
export async function fetchSingleMemberTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
|
||||
}
|
||||
export async function fetchSingleMemberTest(guildId: bigint) {}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
async function ifItFailsBlameWolf(bot: Bot, channelId: bigint, reason?: string) {
|
||||
async function ifItFailsBlameWolf(channelId: bigint, reason?: string) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
@@ -25,10 +25,10 @@ async function ifItFailsBlameWolf(bot: Bot, channelId: bigint, reason?: string)
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteMessageWithoutReasonTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId);
|
||||
export async function deleteMessageWithoutReasonTest(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId);
|
||||
}
|
||||
|
||||
export async function deleteMessageWithReasonTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId, "with a reason");
|
||||
export async function deleteMessageWithReasonTest(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId, "with a reason");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
async function ifItFailsBlameWolf(bot: Bot, channelId: bigint, reason?: string) {
|
||||
async function ifItFailsBlameWolf(channelId: bigint, reason?: string) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
const secondMessage = await bot.helpers.sendMessage(channelId, "Hello World 2!");
|
||||
|
||||
@@ -27,10 +27,10 @@ async function ifItFailsBlameWolf(bot: Bot, channelId: bigint, reason?: string)
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteMessagesWithoutReasonTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId);
|
||||
export async function deleteMessagesWithoutReasonTest(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId);
|
||||
}
|
||||
|
||||
export async function deleteMessagesWithReasonTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId, "with a reason");
|
||||
export async function deleteMessagesWithReasonTest(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId, "with a reason");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function editMessageTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function editMessageTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals, assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function getMessageTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function getMessageTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals, assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function getMessagesTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function getMessagesTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
const secondMessage = await bot.helpers.sendMessage(channelId, "Hello World 2!");
|
||||
const thirdMessage = await bot.helpers.sendMessage(channelId, "Hello World 3!");
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function pinMessageTests(bot: Bot, channelId: bigint, messageId: bigint, t: Deno.TestContext) {
|
||||
export async function pinMessageTests(channelId: bigint, messageId: bigint) {
|
||||
let pinned = false;
|
||||
|
||||
bot.events.channelPinsUpdate = function (bot, payload) {
|
||||
bot.events.channelPinsUpdate = function (_, payload) {
|
||||
if (payload.channelId === channelId) pinned = !pinned;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals, assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
const reactionCounters = new Map<bigint, number>();
|
||||
|
||||
export async function addReactionTest(
|
||||
bot: Bot,
|
||||
guildId: bigint,
|
||||
channelId: bigint,
|
||||
options: { custom: boolean; single: boolean; ordered: boolean },
|
||||
t: Deno.TestContext
|
||||
options: { custom: boolean; single: boolean; ordered: boolean }
|
||||
) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
@@ -76,7 +75,7 @@ export async function addReactionTest(
|
||||
assertEquals(reactionCounters.get(message.id), options.single ? 1 : emojiIds.length);
|
||||
}
|
||||
|
||||
export async function removeAllReactionTests(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function removeAllReactionTests(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
@@ -117,7 +116,7 @@ export async function removeAllReactionTests(bot: Bot, channelId: bigint, t: Den
|
||||
assertEquals(reactionCounters.get(message.id), 0);
|
||||
}
|
||||
|
||||
export async function removeReactionTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function removeReactionTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
@@ -159,7 +158,7 @@ export async function removeReactionTest(bot: Bot, channelId: bigint, t: Deno.Te
|
||||
assertEquals(reactionCounters.get(message.id), 2);
|
||||
}
|
||||
|
||||
export async function removeReactionEmojiTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
export async function removeReactionEmojiTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
import { CreateMessage } from "../../../src/types/messages/createMessage.ts";
|
||||
import { MessageComponentTypes } from "../../../src/types/messages/components/messageComponentTypes.ts";
|
||||
import { ButtonStyles } from "../../../src/types/messages/components/buttonStyles.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
|
||||
async function ifItFailsBlameWolf(bot: Bot, channelId: bigint, content: string | CreateMessage) {
|
||||
async function ifItFailsBlameWolf(channelId: bigint, content: string | CreateMessage) {
|
||||
const message = await bot.helpers.sendMessage(channelId, content);
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
@@ -17,12 +17,12 @@ async function ifItFailsBlameWolf(bot: Bot, channelId: bigint, content: string |
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendMessageWithTextTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId, "Hello World!");
|
||||
export async function sendMessageWithTextTest(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId, "Hello World!");
|
||||
}
|
||||
|
||||
export async function sendMessageWithComponents(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId, {
|
||||
export async function sendMessageWithComponents(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId, {
|
||||
content: "Hello World!",
|
||||
components: [
|
||||
{
|
||||
@@ -57,8 +57,8 @@ export async function sendMessageWithComponents(bot: Bot, channelId: bigint, t:
|
||||
});
|
||||
}
|
||||
|
||||
export async function sendMessageWithEmbedsTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
await ifItFailsBlameWolf(bot, channelId, {
|
||||
export async function sendMessageWithEmbedsTest(channelId: bigint) {
|
||||
await ifItFailsBlameWolf(channelId, {
|
||||
embeds: [
|
||||
{
|
||||
title: "Hello World",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
|
||||
export async function getUserTests(bot: Bot, t: Deno.TestContext) {
|
||||
export async function getUserTests() {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { bot } from "../../mod.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function createRoleTests(bot: Bot, guildId: bigint, options: { reason?: string }, t: Deno.TestContext) {
|
||||
export async function createRoleTests(guildId: bigint, options: { reason?: string }) {
|
||||
const role = await bot.helpers.createRole(guildId, { name: "hoti" }, options.reason);
|
||||
|
||||
assertExists(role);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals, assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function editRoleTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function editRoleTests(guildId: bigint) {
|
||||
const role = await bot.helpers.createRole(guildId, {
|
||||
name: "hoti",
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertEquals } from "../../deps.ts";
|
||||
|
||||
export async function getRolesTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
export async function getRolesTest(guildId: bigint) {
|
||||
const roles = await bot.helpers.getRoles(guildId);
|
||||
|
||||
assertEquals(bot.guilds.get(guildId)?.roles.size, roles.size);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { bot } from "../mod.ts";
|
||||
|
||||
Deno.test("[member] get dm channel and send a message", async () => {
|
||||
// Skillz ID
|
||||
const channel = await bot.helpers.getDmChannel(130136895395987456n);
|
||||
// Itoh Alt ID
|
||||
const channel = await bot.helpers.getDmChannel(750661528360845322n);
|
||||
await bot.helpers.sendMessage(channel.id, "https://i.imgur.com/doG55NR.png");
|
||||
});
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
import { Bot } from "../../mod.ts";
|
||||
import { reactionCounters } from "../constants.ts";
|
||||
import { assertExists, assertEquals } from "../deps.ts";
|
||||
// import {
|
||||
// addReactionTest,
|
||||
// removeReactionTest,
|
||||
// removeAllReactionTests,
|
||||
// removeReactionEmojiTest,
|
||||
// } from "../helpers/messages/reactions.ts";
|
||||
import { bot, guild, channel } from "../mod.ts";
|
||||
import { delayUntil } from "../utils.ts";
|
||||
|
||||
export async function addReactionTest(
|
||||
guildId: bigint,
|
||||
channelId: bigint,
|
||||
options: { custom: boolean; single: boolean; ordered: boolean },
|
||||
) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => bot.messages.has(message.id));
|
||||
|
||||
if (!bot.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
}
|
||||
|
||||
let emojiId = "❤";
|
||||
let emojiIds = ["❤", "😃"];
|
||||
|
||||
if (options.custom) {
|
||||
if (options.single) {
|
||||
emojiId = `<:blamewolf:${
|
||||
(
|
||||
await bot.helpers.createEmoji(guildId, {
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
// roles: [],
|
||||
})
|
||||
).id
|
||||
}>`;
|
||||
} else {
|
||||
emojiIds = [
|
||||
`<:blamewolf:${
|
||||
(
|
||||
await bot.helpers.createEmoji(guildId, {
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
// roles: [],
|
||||
})
|
||||
).id
|
||||
}>`,
|
||||
`<:blamewolf2:${
|
||||
(
|
||||
await bot.helpers.createEmoji(guildId, {
|
||||
name: "blamewolf2",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
// roles: [],
|
||||
})
|
||||
).id
|
||||
}>`,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
reactionCounters.set(message.id, 0);
|
||||
|
||||
bot.events.reactionAdd = function (bot, payload) {
|
||||
const current = reactionCounters.get(payload.messageId) || 0;
|
||||
reactionCounters.set(payload.messageId, current + 1);
|
||||
};
|
||||
|
||||
if (options.single) await bot.helpers.addReaction(message.channelId, message.id, emojiId);
|
||||
else await bot.helpers.addReactions(message.channelId, message.id, emojiIds, options.ordered);
|
||||
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === (options.single ? 1 : emojiIds.length));
|
||||
|
||||
assertEquals(reactionCounters.get(message.id), options.single ? 1 : emojiIds.length);
|
||||
}
|
||||
|
||||
export async function removeAllReactionTests(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => bot.messages.has(message.id));
|
||||
|
||||
if (!bot.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
}
|
||||
|
||||
reactionCounters.set(message.id, 0);
|
||||
|
||||
bot.events.reactionRemoveAll = function (_, payload) {
|
||||
reactionCounters.set(payload.messageId, 0);
|
||||
};
|
||||
|
||||
bot.events.reactionAdd = function (_, payload) {
|
||||
const current = reactionCounters.get(payload.messageId) || 0;
|
||||
reactionCounters.set(payload.messageId, current + 1);
|
||||
};
|
||||
|
||||
// Add reactions to the message
|
||||
await bot.helpers.addReactions(message.channelId, message.id, ["❤", "😃", "🤫"]);
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === 3);
|
||||
|
||||
// Be sure that the message has the reactions
|
||||
assertEquals(reactionCounters.get(message.id), 3);
|
||||
|
||||
await bot.helpers.removeAllReactions(message.channelId, message.id);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === 0);
|
||||
|
||||
// Check if the reactions has been deleted
|
||||
assertEquals(reactionCounters.get(message.id), 0);
|
||||
}
|
||||
|
||||
export async function removeReactionTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => bot.messages.has(message.id));
|
||||
|
||||
if (!bot.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
}
|
||||
|
||||
reactionCounters.set(message.id, 0);
|
||||
|
||||
bot.events.reactionRemove = function (bot, payload) {
|
||||
const current = reactionCounters.get(message.id);
|
||||
reactionCounters.set(payload.messageId, (current || 0) - 1);
|
||||
};
|
||||
|
||||
bot.events.reactionAdd = function (bot, payload) {
|
||||
const current = reactionCounters.get(payload.messageId) || 0;
|
||||
reactionCounters.set(payload.messageId, current + 1);
|
||||
};
|
||||
|
||||
// Add reactions to the message
|
||||
await bot.helpers.addReactions(message.channelId, message.id, ["❤", "😃", "🤫"]);
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === 3);
|
||||
|
||||
// Be sure that the message has the reactions
|
||||
assertEquals(reactionCounters.get(message.id), 3);
|
||||
|
||||
await bot.helpers.removeReaction(message.channelId, message.id, "😃");
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === 2);
|
||||
|
||||
// Check if the reactions has been deleted
|
||||
assertEquals(reactionCounters.get(message.id), 2);
|
||||
}
|
||||
|
||||
export async function removeReactionEmojiTest(channelId: bigint) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => bot.messages.has(message.id));
|
||||
|
||||
if (!bot.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
}
|
||||
|
||||
reactionCounters.set(message.id, 0);
|
||||
|
||||
bot.events.reactionAdd;
|
||||
|
||||
bot.events.reactionRemoveEmoji = function (bot, payload) {
|
||||
reactionCounters.set(payload.messageId, 0);
|
||||
};
|
||||
|
||||
bot.events.reactionAdd = function (bot, payload) {
|
||||
const current = reactionCounters.get(payload.messageId) || 0;
|
||||
reactionCounters.set(payload.messageId, current + 1);
|
||||
};
|
||||
|
||||
// Add reactions to the message
|
||||
await bot.helpers.addReactions(message.channelId, message.id, ["❤", "😃"]);
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === 2);
|
||||
|
||||
// Be sure that the message has the reactions
|
||||
assertEquals(reactionCounters.get(message.id), 2);
|
||||
|
||||
await bot.helpers.removeReactionEmoji(message.channelId, message.id, "😃");
|
||||
|
||||
// Delay the execution to allow event to be processed
|
||||
await delayUntil(10000, () => reactionCounters.get(message.id) === 0);
|
||||
|
||||
// Check if the reactions has been deleted
|
||||
assertEquals(reactionCounters.get(message.id), 0);
|
||||
}
|
||||
|
||||
Deno.test({
|
||||
name: "[message] add a reaction",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(guild.id, channel.id, { custom: false, single: true, ordered: false });
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add a custom reaction",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(guild.id, channel.id, { custom: true, single: true, ordered: false });
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple reactions",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(guild.id, channel.id, { custom: false, single: false, ordered: false });
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple custom reactions",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(guild.id, channel.id, { custom: true, single: false, ordered: false });
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple reactions in order",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(guild.id, channel.id, { custom: false, single: false, ordered: true });
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple custom reactions in order",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(guild.id, channel.id, { custom: true, single: false, ordered: true });
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] remove a reaction.",
|
||||
fn: async (t) => {
|
||||
await removeReactionTest(channel.id);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] remove all reactions.",
|
||||
fn: async (t) => {
|
||||
await removeAllReactionTests(channel.id);
|
||||
},
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] remove emoji reactions.",
|
||||
fn: async (t) => {
|
||||
await removeReactionEmojiTest(channel.id);
|
||||
},
|
||||
});
|
||||
+51
-295
@@ -63,7 +63,9 @@ const baseBot = createBot({
|
||||
],
|
||||
});
|
||||
|
||||
const bot = enableCachePlugin(baseBot);
|
||||
// @ts-ignore
|
||||
export const bot = enableCachePlugin(baseBot);
|
||||
// @ts-ignore
|
||||
await startBot(bot);
|
||||
|
||||
// Delay the execution to allow READY events to be processed
|
||||
@@ -71,7 +73,7 @@ await delayUntil(10000, () => Boolean(startedAt));
|
||||
console.log("Bot online");
|
||||
|
||||
// DELETE GUILDS IF LESS THAN 10 SERVERS AS SAFETY MEASURE
|
||||
if (bot.guilds.size() <= 10) {
|
||||
if (bot.guilds.size <= 10) {
|
||||
bot.guilds.forEach(async (guild) => {
|
||||
// DO NOT DELETE OUR CACHED TEST SERVER FOR COMMUNITY FEATURES
|
||||
if (guild.id === CACHED_COMMUNITY_GUILD_ID) return;
|
||||
@@ -107,105 +109,66 @@ export const message = await bot.helpers.sendMessage(channel.id, "Hello Skillz")
|
||||
|
||||
import "./benchmark.ts";
|
||||
|
||||
Deno.test({
|
||||
name: "[guild] format a guild's icon url",
|
||||
fn: async (t) => {
|
||||
assertEquals(bot.helpers.guildIconURL(guild.id, { icon: guild.icon }), undefined);
|
||||
assertEquals(
|
||||
bot.helpers.guildIconURL(785384884197392384n, {
|
||||
icon: 3837424427068676005442449262648382018748n,
|
||||
}),
|
||||
"https://cdn.discordapp.com/icons/785384884197392384/46f50fb412eab14ec455d5cf777154bc.jpg?size=128"
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] format a guild's banner url",
|
||||
fn: async (t) => {
|
||||
assertEquals(bot.helpers.guildBannerURL(guild.id, { banner: guild.banner }), undefined);
|
||||
assertEquals(
|
||||
bot.helpers.guildBannerURL(613425648685547541n, {
|
||||
banner: 3919584870146358272366452115178209474142n,
|
||||
}),
|
||||
"https://cdn.discordapp.com/banners/613425648685547541/84c4964c115c128fb9100952c3b4f65e.jpg?size=128"
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] format a guild's splash url",
|
||||
fn: async (t) => {
|
||||
assertEquals(bot.helpers.guildSplashURL(guild.id, { splash: guild.splash }), undefined);
|
||||
assertEquals(
|
||||
bot.helpers.guildSplashURL(785384884197392384n, {
|
||||
splash: 3837424427068676005442449262648382018748n,
|
||||
}),
|
||||
"https://cdn.discordapp.com/splashes/785384884197392384/46f50fb412eab14ec455d5cf777154bc.jpg?size=128"
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] create a guild",
|
||||
fn: async (t) => {
|
||||
await createGuildTests(bot, t);
|
||||
await createGuildTests();
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] delete a guild",
|
||||
fn: async (t) => {
|
||||
await deleteGuildTests(bot, t);
|
||||
await deleteGuildTests();
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] edit a guild",
|
||||
fn: async (t) => {
|
||||
await editGuildTests(bot, guild.id, t);
|
||||
await editGuildTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] get audit logs",
|
||||
fn: async (t) => {
|
||||
await getAuditLogsTests(bot, guild.id, t);
|
||||
await getAuditLogsTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] get available voice regions",
|
||||
fn: async (t) => {
|
||||
await getAvailableVoiceRegionsTests(bot, t);
|
||||
await getAvailableVoiceRegionsTests();
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] get a ban",
|
||||
fn: async (t) => {
|
||||
await getBanTests(bot, guild.id, t);
|
||||
await getBanTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] get bans",
|
||||
fn: async (t) => {
|
||||
await getBansTests(bot, guild.id, t);
|
||||
await getBansTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] get guilds",
|
||||
fn: async (t) => {
|
||||
await getGuildTests(bot, guild.id, t);
|
||||
await getGuildTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[guild] get vanity url",
|
||||
fn: async (t) => {
|
||||
await getVanityURLTests(bot, guild.id, t);
|
||||
await getVanityURLTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
@@ -213,140 +176,78 @@ Deno.test({
|
||||
Deno.test({
|
||||
name: "[message] send message with text",
|
||||
fn: async (t) => {
|
||||
await sendMessageWithTextTest(bot, channel.id, t);
|
||||
await sendMessageWithTextTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] send message with embeds",
|
||||
fn: async (t) => {
|
||||
await sendMessageWithEmbedsTest(bot, channel.id, t);
|
||||
await sendMessageWithEmbedsTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] send message with components",
|
||||
fn: async (t) => {
|
||||
await sendMessageWithComponents(bot, channel.id, t);
|
||||
await sendMessageWithComponents(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] edit message",
|
||||
fn: async (t) => {
|
||||
await editMessageTest(bot, channel.id, t);
|
||||
await editMessageTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] delete message without a reason",
|
||||
fn: async (t) => {
|
||||
await deleteMessageWithoutReasonTest(bot, channel.id, t);
|
||||
await deleteMessageWithoutReasonTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] delete message with a reason",
|
||||
fn: async (t) => {
|
||||
await deleteMessageWithReasonTest(bot, channel.id, t);
|
||||
await deleteMessageWithReasonTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] delete messages without a reason",
|
||||
fn: async (t) => {
|
||||
await deleteMessagesWithoutReasonTest(bot, channel.id, t);
|
||||
await deleteMessagesWithoutReasonTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] delete messages with a reason",
|
||||
fn: async (t) => {
|
||||
await deleteMessagesWithReasonTest(bot, channel.id, t);
|
||||
await deleteMessagesWithReasonTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] fetch a message",
|
||||
fn: async (t) => {
|
||||
await getMessageTest(bot, channel.id, t);
|
||||
await getMessageTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] fetch messages",
|
||||
fn: async (t) => {
|
||||
await getMessagesTest(bot, channel.id, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add a reaction",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(bot, guild.id, channel.id, { custom: false, single: true, ordered: false }, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add a custom reaction",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(bot, guild.id, channel.id, { custom: true, single: true, ordered: false }, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple reactions",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(bot, guild.id, channel.id, { custom: false, single: false, ordered: false }, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple custom reactions",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(bot, guild.id, channel.id, { custom: true, single: false, ordered: false }, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple reactions in order",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(bot, guild.id, channel.id, { custom: false, single: false, ordered: true }, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] add multiple custom reactions in order",
|
||||
fn: async (t) => {
|
||||
await addReactionTest(bot, guild.id, channel.id, { custom: true, single: false, ordered: true }, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] remove a reaction.",
|
||||
fn: async (t) => {
|
||||
await removeReactionTest(bot, channel.id, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] remove all reactions.",
|
||||
fn: async (t) => {
|
||||
await removeAllReactionTests(bot, channel.id, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[message] remove emoji reactions.",
|
||||
fn: async (t) => {
|
||||
await removeReactionEmojiTest(bot, channel.id, t);
|
||||
await getMessagesTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[message] pin a message",
|
||||
fn: async (t) => {
|
||||
await pinMessageTests(bot, channel.id, message.id, t);
|
||||
await pinMessageTests(channel.id, message.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
@@ -354,221 +255,72 @@ Deno.test({
|
||||
Deno.test({
|
||||
name: "[channel] send message with text",
|
||||
fn: async (t) => {
|
||||
await sendMessageWithTextTest(bot, channel.id, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(bot, guild.id, { name: "Discordeno-test" }, false, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new category channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildCategory,
|
||||
},
|
||||
false,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new news channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
CACHED_COMMUNITY_GUILD_ID,
|
||||
{ name: "Discordeno-test", type: ChannelTypes.GuildNews },
|
||||
true,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new voice channel",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildVoice,
|
||||
},
|
||||
false,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new voice channel with a bitrate",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
name: "discordeno-test",
|
||||
type: ChannelTypes.GuildVoice,
|
||||
bitrate: 32000,
|
||||
},
|
||||
false,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new voice channel with a user limit",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
type: ChannelTypes.GuildVoice,
|
||||
userLimit: 32,
|
||||
},
|
||||
false,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel with a rate limit per user",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
rateLimitPerUser: 2423,
|
||||
},
|
||||
false,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel with NSFW",
|
||||
async fn(t) {
|
||||
await createChannelTests(bot, guild.id, { name: "Discordeno-test", nsfw: true }, false, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] create a new text channel with permission overwrites",
|
||||
async fn(t) {
|
||||
await createChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
name: "Discordeno-test",
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bot.id,
|
||||
type: OverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
false,
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] delete a channel with a reason",
|
||||
async fn(t) {
|
||||
await deleteChannelTests(
|
||||
bot,
|
||||
guild.id,
|
||||
{
|
||||
reason: "with a reason",
|
||||
},
|
||||
t
|
||||
);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] delete a channel without a reason",
|
||||
async fn(t) {
|
||||
await deleteChannelTests(bot, guild.id, {}, t);
|
||||
await sendMessageWithTextTest(channel.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
|
||||
|
||||
Deno.test({
|
||||
name: "[channel] filter all category channels",
|
||||
async fn(t) {
|
||||
await categoryChildrenTest(bot, guild.id, t);
|
||||
await categoryChildrenTest(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] edit a channel permission overwrite",
|
||||
async fn(t) {
|
||||
await channelOverwriteHasPermissionTest(bot, guild.id, t);
|
||||
await channelOverwriteHasPermissionTest(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] clone a channel w/o a reason",
|
||||
async fn(t) {
|
||||
await cloneChannelTests(bot, guild.id, channel, {}, t);
|
||||
await cloneChannelTests({});
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] clone a channel w/ a reason",
|
||||
async fn(t) {
|
||||
await cloneChannelTests(bot, guild.id, channel, { reason: "Blame wolf" }, t);
|
||||
await cloneChannelTests({ reason: "Blame wolf" });
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] delete a channel overwrite",
|
||||
async fn(t) {
|
||||
await deleteChannelOverwriteTests(bot, guild.id, t);
|
||||
await deleteChannelOverwriteTests(guild.id);
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] edit a channel w/o a reason",
|
||||
async fn(t) {
|
||||
await editChannelTests(bot, guild.id, {}, t);
|
||||
await editChannelTests(guild.id, {});
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
Deno.test({
|
||||
name: "[channel] edit a channel w/ a reason",
|
||||
async fn(t) {
|
||||
await editChannelTests(bot, guild.id, { reason: "Blame wolf" }, t);
|
||||
await editChannelTests(guild.id, { reason: "Blame wolf" });
|
||||
},
|
||||
...sanitizeMode,
|
||||
});
|
||||
|
||||
//channels
|
||||
// channels
|
||||
import "./channels/connectToVoice.ts";
|
||||
import "./channels/createChannel.ts";
|
||||
import "./channels/deleteChannel.ts";
|
||||
import "./channels/getChannel.ts";
|
||||
import "./channels/getChannels.ts";
|
||||
import "./channels/stageInstances.ts";
|
||||
import "./channels/threads.ts";
|
||||
|
||||
//emoji
|
||||
// emoji
|
||||
import "./emoji/createEmoji.ts";
|
||||
import "./emoji/deleteEmojiWithReason.ts";
|
||||
import "./emoji/deleteEmojiWithoutReason.ts";
|
||||
@@ -577,21 +329,27 @@ import "./emoji/emojiUrl.ts";
|
||||
import "./emoji/getEmoji.ts";
|
||||
import "./emoji/getMultipleEmojis.ts";
|
||||
|
||||
//invite
|
||||
// guilds
|
||||
import "./guilds/urls.ts";
|
||||
|
||||
// invite
|
||||
import "./invite/createInvite.ts";
|
||||
import "./invite/deleteInvite.ts";
|
||||
import "./invite/getChannelInvites.ts";
|
||||
import "./invite/getInvite.ts";
|
||||
import "./invite/getInvites.ts";
|
||||
|
||||
//members
|
||||
// members
|
||||
import "./members/avatarlUrl.ts";
|
||||
import "./members/ban.ts";
|
||||
import "./members/editBotNickname.ts";
|
||||
import "./members/getDmChannel.ts";
|
||||
import "./members/getMember.ts";
|
||||
|
||||
//misc
|
||||
// messages
|
||||
import "./messages/reactions.ts";
|
||||
|
||||
// misc
|
||||
import "./misc/getApplicationInfo.ts";
|
||||
import "./misc/getDiscoveryCategories.ts";
|
||||
import "./misc/getUser.ts";
|
||||
@@ -601,7 +359,7 @@ import "./misc/typing.ts";
|
||||
import "./misc/validateDiscovery.ts";
|
||||
import "./misc/editBotStatus.ts";
|
||||
|
||||
//role
|
||||
// role
|
||||
import "./role/addRole.ts";
|
||||
import "./role/createRoleWithoutReason.ts";
|
||||
import "./role/createRoleWithReason.ts";
|
||||
@@ -611,7 +369,7 @@ import "./role/editRole.ts";
|
||||
import "./role/getAllRoles.ts";
|
||||
import "./role/removeRole.ts";
|
||||
|
||||
//scheduledEvents
|
||||
// scheduledEvents
|
||||
import "./scheduledEvents/createExternalEventWithEndtime.ts";
|
||||
import "./scheduledEvents/createExternalEventWithoutEndtime.ts";
|
||||
import "./scheduledEvents/createStageEventWithEndtime.ts";
|
||||
@@ -621,11 +379,9 @@ import "./scheduledEvents/createVoiceEventWithoutEndtime.ts";
|
||||
import "./scheduledEvents/deleteEvent.ts";
|
||||
import "./scheduledEvents/editEvent.ts";
|
||||
|
||||
//webhooks
|
||||
// webhooks
|
||||
import "./webhooks/deleteWebhook.ts";
|
||||
import "./webhooks/deleteWebhookWithToken.ts";
|
||||
import "./webhooks/sendWebhook.ts";
|
||||
import "./webhooks/webhooks.ts";
|
||||
// await bot.helpers.deleteGuild(guild.id);
|
||||
|
||||
// await stopBot(bot);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { delayUntil } from "../utils.ts";
|
||||
Deno.test({
|
||||
name: "[Role] create a role with a reason",
|
||||
fn: async (t) => {
|
||||
await createRoleTests(bot, guild.id, { reason: "Blame wolfy" }, t);
|
||||
await createRoleTests(guild.id, { reason: "Blame wolfy" });
|
||||
|
||||
const role = await bot.helpers.createRole(guild.id, { name: "hoti" }, "Blame wolfy");
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { delayUntil } from "../utils.ts";
|
||||
Deno.test({
|
||||
name: "[Role] create a role without a reason",
|
||||
fn: async (t) => {
|
||||
await createRoleTests(bot, guild.id, {}, t);
|
||||
await createRoleTests(guild.id, {});
|
||||
|
||||
const role = await bot.helpers.createRole(guild.id, { name: "hoti" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user