mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
Deno fmt
This commit is contained in:
@@ -9,7 +9,11 @@ import {
|
||||
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
|
||||
import { assertEquals, assertExists } from "../deps.ts";
|
||||
|
||||
async function ifItFailsBlameWolf(type: "getter" | "raw", custom = false, ordered = false) {
|
||||
async function ifItFailsBlameWolf(
|
||||
type: "getter" | "raw",
|
||||
custom = false,
|
||||
ordered = false,
|
||||
) {
|
||||
const message = await sendMessage(tempData.channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
@@ -24,32 +28,35 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", custom = false, ordere
|
||||
);
|
||||
}
|
||||
|
||||
let emojiIds = ["❤","😃"];
|
||||
let emojiIds = ["❤", "😃"];
|
||||
|
||||
if (custom) {
|
||||
emojiIds = [`<:blamewolf:${
|
||||
(await createEmoji(
|
||||
tempData.guildId,
|
||||
"blamewolf",
|
||||
"https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
{
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
roles: [],
|
||||
},
|
||||
)).id
|
||||
}>`,`<:blamewolf2:${
|
||||
emojiIds = [
|
||||
`<:blamewolf:${
|
||||
(await createEmoji(
|
||||
tempData.guildId,
|
||||
"blamewolf2",
|
||||
"https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
{
|
||||
name: "blamewolf2",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
roles: [],
|
||||
},
|
||||
tempData.guildId,
|
||||
"blamewolf",
|
||||
"https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
{
|
||||
name: "blamewolf",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
roles: [],
|
||||
},
|
||||
)).id
|
||||
}>`];
|
||||
}>`,
|
||||
`<:blamewolf2:${
|
||||
(await createEmoji(
|
||||
tempData.guildId,
|
||||
"blamewolf2",
|
||||
"https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
{
|
||||
name: "blamewolf2",
|
||||
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
|
||||
roles: [],
|
||||
},
|
||||
)).id
|
||||
}>`,
|
||||
];
|
||||
}
|
||||
|
||||
if (type === "raw") {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import {cache, delay, deleteMessage, deleteMessages, sendMessage} from "../../mod.ts";
|
||||
import {
|
||||
cache,
|
||||
delay,
|
||||
deleteMessage,
|
||||
deleteMessages,
|
||||
sendMessage,
|
||||
} from "../../mod.ts";
|
||||
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
|
||||
import { assertExists } from "../deps.ts";
|
||||
|
||||
@@ -25,12 +31,16 @@ async function ifItFailsBlameWolf(reason?: string) {
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(secondMessage.id)) {
|
||||
throw new Error(
|
||||
"The message seemed to be sent but it was not cached.",
|
||||
"The message seemed to be sent but it was not cached.",
|
||||
);
|
||||
}
|
||||
|
||||
// Delete the message now
|
||||
await deleteMessages(tempData.channelId, [message.id,secondMessage.id], reason);
|
||||
await deleteMessages(
|
||||
tempData.channelId,
|
||||
[message.id, secondMessage.id],
|
||||
reason,
|
||||
);
|
||||
|
||||
// Wait 5 seconds to give it time for MESSAGE_DELETE event
|
||||
await delay(5000);
|
||||
@@ -53,7 +63,7 @@ Deno.test({
|
||||
Deno.test({
|
||||
name: "[message] delete messages with a reason.",
|
||||
async fn() {
|
||||
await ifItFailsBlameWolf( "with a reason");
|
||||
await ifItFailsBlameWolf("with a reason");
|
||||
},
|
||||
...defaultTestOptions,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user