This commit is contained in:
ITOH
2021-04-15 18:06:31 +02:00
parent 6a6acf2d6c
commit 98bf292aff
27 changed files with 94 additions and 141 deletions
+1 -1
View File
@@ -11,4 +11,4 @@ jobs:
- name: Commit formatted files - name: Commit formatted files
uses: EndBug/add-and-commit@v7 uses: EndBug/add-and-commit@v7
- name: Run lint script - name: Run lint script
run: deno lint src/** test/** --unstable --ignore=./src/types,./src/interactions/types run: deno lint src/** test/** --unstable --ignore=./src/types
+1 -4
View File
@@ -2,10 +2,7 @@ import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { import { DiscordGuildMemberWithUser } from "../../types/guilds/guild_member.ts";
DiscordGuildMemberWithUser,
GuildMemberWithUser,
} from "../../types/guilds/guild_member.ts";
import { DiscordMessage, Message } from "../../types/messages/message.ts"; import { DiscordMessage, Message } from "../../types/messages/message.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts"; import { snakeKeysToCamelCase } from "../../util/utils.ts";
+4 -4
View File
@@ -37,15 +37,15 @@ export function fetchMembers(
// TODO: finish implementing this // TODO: finish implementing this
function requestAllMembers( function requestAllMembers(
guildId: string, _guildId: string,
shardId: number, _shardId: number,
resolve: ( _resolve: (
value: value:
| Collection<string, DiscordenoMember> | Collection<string, DiscordenoMember>
| PromiseLike<Collection<string, DiscordenoMember>>, | PromiseLike<Collection<string, DiscordenoMember>>,
) => void, ) => void,
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
options: any, _options: any,
): void { ): void {
throw new Error("Function not implemented."); throw new Error("Function not implemented.");
} }
+1 -4
View File
@@ -1,10 +1,7 @@
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import { import { DiscordGuildMemberWithUser } from "../../types/guilds/guild_member.ts";
DiscordGuildMember,
DiscordGuildMemberWithUser,
} from "../../types/guilds/guild_member.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
/** Returns a guild member object for the specified user. /** Returns a guild member object for the specified user.
-1
View File
@@ -7,7 +7,6 @@ import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
import { import {
DiscordGuildMember, DiscordGuildMember,
DiscordGuildMemberWithUser, DiscordGuildMemberWithUser,
GuildMember,
} from "../../types/guilds/guild_member.ts"; } from "../../types/guilds/guild_member.ts";
import { ListGuildMembers } from "../../types/guilds/list_guild_members.ts"; import { ListGuildMembers } from "../../types/guilds/list_guild_members.ts";
import { Errors } from "../../types/misc/errors.ts"; import { Errors } from "../../types/misc/errors.ts";
+5 -4
View File
@@ -22,15 +22,16 @@ export async function getMembersByQuery(
}) as Promise<Collection<string, DiscordenoMember>>; }) as Promise<Collection<string, DiscordenoMember>>;
} }
// TODO: implement this
function requestAllMembers( function requestAllMembers(
id: string, _id: string,
shardId: number, _shardId: number,
resolve: ( _resolve: (
value: value:
| Collection<string, DiscordenoMember> | Collection<string, DiscordenoMember>
| PromiseLike<Collection<string, DiscordenoMember>>, | PromiseLike<Collection<string, DiscordenoMember>>,
) => void, ) => void,
arg3: { query: string; limit: number }, _arg3: { query: string; limit: number },
): void { ): void {
throw new Error("Function not implemented."); throw new Error("Function not implemented.");
} }
-1
View File
@@ -2,7 +2,6 @@ import { botId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { DiscordenoMessage } from "../../structures/message.ts"; import { DiscordenoMessage } from "../../structures/message.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import { CreateMessage } from "../../types/messages/create_message.ts";
import { EditMessage } from "../../types/messages/edit_message.ts"; import { EditMessage } from "../../types/messages/edit_message.ts";
import { DiscordMessage } from "../../types/messages/message.ts"; import { DiscordMessage } from "../../types/messages/message.ts";
import { Errors } from "../../types/misc/errors.ts"; import { Errors } from "../../types/misc/errors.ts";
+2
View File
@@ -29,6 +29,8 @@ export async function startServer(
const server = serve({ port: serverOptions.port }); const server = serve({ port: serverOptions.port });
for await (const req of server) { for await (const req of server) {
// TODO: this is going to be removed
// deno-lint-ignore no-deprecated-deno-api
const buffer = await Deno.readAll(req.body); const buffer = await Deno.readAll(req.body);
const signature = req.headers.get("X-Signature-Ed25519"); const signature = req.headers.get("X-Signature-Ed25519");
const timestamp = req.headers.get("X-Signature-Timestamp"); const timestamp = req.headers.get("X-Signature-Timestamp");
+1
View File
@@ -1,3 +1,4 @@
// deno-lint-ignore-file no-unused-vars
import { checkRateLimits } from "./check_rate_limits.ts"; import { checkRateLimits } from "./check_rate_limits.ts";
import { cleanupQueues } from "./cleanup_queues.ts"; import { cleanupQueues } from "./cleanup_queues.ts";
import { createRequestBody } from "./create_request_body.ts"; import { createRequestBody } from "./create_request_body.ts";
+2 -2
View File
@@ -1,11 +1,11 @@
import { eventHandlers } from "../bot.ts"; import { eventHandlers } from "../bot.ts";
import { cache } from "../cache.ts"; import { cache } from "../cache.ts";
import { channelOverwriteHasPermission } from "../helpers/channels/channel_overwrite_has_permission.ts"; import { channelOverwriteHasPermission } from "../helpers/channels/channel_overwrite_has_permission.ts";
import { cloneChannel } from "../helpers/channels/clone_channel.ts";
import { deleteChannel } from "../helpers/channels/delete_channel.ts"; import { deleteChannel } from "../helpers/channels/delete_channel.ts";
import { deleteChannelOverwrite } from "../helpers/channels/delete_channel_overwrite.ts"; import { deleteChannelOverwrite } from "../helpers/channels/delete_channel_overwrite.ts";
import { editChannel } from "../helpers/channels/edit_channel.ts"; import { editChannel } from "../helpers/channels/edit_channel.ts";
import { editChannelOverwrite } from "../helpers/channels/edit_channel_overwrite.ts"; import { editChannelOverwrite } from "../helpers/channels/edit_channel_overwrite.ts";
import { cloneChannel } from "../helpers/channels/clone_channel.ts";
import { sendMessage } from "../helpers/messages/send_message.ts"; import { sendMessage } from "../helpers/messages/send_message.ts";
import { disconnectMember } from "../helpers/mod.ts"; import { disconnectMember } from "../helpers/mod.ts";
import { Channel, DiscordChannel } from "../types/channels/channel.ts"; import { Channel, DiscordChannel } from "../types/channels/channel.ts";
@@ -40,7 +40,7 @@ const baseChannel: Partial<DiscordenoChannel> = {
if (!voiceStates) return undefined; if (!voiceStates) return undefined;
return new Collection( return new Collection(
voiceStates.map((vs, key) => [key, cache.members.get(key)]), voiceStates.map((vs) => [vs.userId, cache.members.get(vs.userId)]),
); );
}, },
send(content) { send(content) {
+2 -2
View File
@@ -3,9 +3,9 @@ import { ws } from "./ws.ts";
/** Allows users to hook in and change to communicate to different clusters across different servers or anything they like. For example using redis pubsub to talk to other servers. */ /** Allows users to hook in and change to communicate to different clusters across different servers or anything they like. For example using redis pubsub to talk to other servers. */
export async function tellClusterToIdentify( export async function tellClusterToIdentify(
workerId: number, _workerId: number,
shardId: number, shardId: number,
bucketId: number, _bucketId: number,
) { ) {
// When resharding this may exist already // When resharding this may exist already
const oldShard = ws.shards.get(shardId); const oldShard = ws.shards.get(shardId);
@@ -1,18 +1,16 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { delayUntil } from "../util/delay_until.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { botId } from "../../src/bot.ts"; import { botId } from "../../src/bot.ts";
import { deleteChannelOverwrite } from "../../src/helpers/channels/delete_channel_overwrite.ts"; import { cache } from "../../src/cache.ts";
import { editChannelOverwrite } from "../../src/helpers/channels/edit_channel_overwrite.ts";
import { channelOverwriteHasPermission } from "../../src/helpers/channels/channel_overwrite_has_permission.ts"; import { channelOverwriteHasPermission } from "../../src/helpers/channels/channel_overwrite_has_permission.ts";
import { DiscordBitwisePermissionFlags } from "../../src/types/permissions/bitwise_permission_flags.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
async function ifItFailsBlameWolf(options: CreateGuildChannel, save = false) { // TODO: whats save?
async function ifItFailsBlameWolf(options: CreateGuildChannel, _save = false) {
const channel = await createChannel(tempData.guildId, options); const channel = await createChannel(tempData.guildId, options);
// Assertions // Assertions
+8 -7
View File
@@ -1,15 +1,16 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts"; import { botId } from "../../src/bot.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { cloneChannel } from "../../src/helpers/channels/clone_channel.ts"; import { cloneChannel } from "../../src/helpers/channels/clone_channel.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { delayUntil } from "../util/delay_until.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts"; import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
async function ifItFailsBlameWolf(options: CreateGuildChannel, save = false) { // TODO: whats save
async function ifItFailsBlameWolf(options: CreateGuildChannel, _save = false) {
const channel = await createChannel(tempData.guildId, options); const channel = await createChannel(tempData.guildId, options);
const cloned = await cloneChannel(channel.id); const cloned = await cloneChannel(channel.id);
+9 -9
View File
@@ -1,15 +1,15 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { delayUntil } from "../util/delay_until.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { botId } from "../../src/bot.ts"; import { botId } from "../../src/bot.ts";
import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { deleteChannelOverwrite } from "../../src/helpers/channels/delete_channel_overwrite.ts"; import { deleteChannelOverwrite } from "../../src/helpers/channels/delete_channel_overwrite.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
async function ifItFailsBlameWolf(options: CreateGuildChannel, save = false) { async function ifItFailsBlameWolf(options: CreateGuildChannel, _save = false) {
const channel = await createChannel(tempData.guildId, options); const channel = await createChannel(tempData.guildId, options);
// Assertions // Assertions
+11 -12
View File
@@ -1,18 +1,17 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { delayUntil } from "../util/delay_until.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { botId } from "../../src/bot.ts"; import { botId } from "../../src/bot.ts";
import { deleteChannelOverwrite } from "../../src/helpers/channels/delete_channel_overwrite.ts"; import { cache } from "../../src/cache.ts";
import { editChannelOverwrite } from "../../src/helpers/channels/edit_channel_overwrite.ts";
import { channelOverwriteHasPermission } from "../../src/helpers/channels/channel_overwrite_has_permission.ts"; import { channelOverwriteHasPermission } from "../../src/helpers/channels/channel_overwrite_has_permission.ts";
import { DiscordBitwisePermissionFlags } from "../../src/types/permissions/bitwise_permission_flags.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { editChannelOverwrite } from "../../src/helpers/channels/edit_channel_overwrite.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { CreateGuildChannel } from "../../src/types/guilds/create_guild_channel.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
async function ifItFailsBlameWolf(options: CreateGuildChannel, save = false) { // TODO: whats save
async function ifItFailsBlameWolf(options: CreateGuildChannel, _save = false) {
const channel = await createChannel(tempData.guildId, options); const channel = await createChannel(tempData.guildId, options);
// Assertions // Assertions
+3 -6
View File
@@ -1,12 +1,9 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { deleteChannel } from "../../src/helpers/channels/delete_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { editChannel } from "../../src/helpers/channels/edit_channel.ts";
import { assertEquals } from "../deps.ts";
import { getChannel } from "../../src/helpers/channels/get_channel.ts"; import { getChannel } from "../../src/helpers/channels/get_channel.ts";
import { botId } from "../../src/bot.ts"; import { assertEquals } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[channel] get a channel", name: "[channel] get a channel",
+3 -8
View File
@@ -1,13 +1,8 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { deleteChannel } from "../../src/helpers/channels/delete_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { editChannel } from "../../src/helpers/channels/edit_channel.ts";
import { assertEquals } from "../deps.ts";
import { getChannel } from "../../src/helpers/channels/get_channel.ts";
import { botId } from "../../src/bot.ts";
import { getChannels } from "../../src/helpers/channels/get_channels.ts"; import { getChannels } from "../../src/helpers/channels/get_channels.ts";
import { assertEquals } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[channel] get channels.", name: "[channel] get channels.",
+4 -6
View File
@@ -1,12 +1,10 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { getChannels } from "../../src/helpers/channels/get_channels.ts";
import { sendMessage } from "../../src/helpers/messages/send_message.ts";
import { getPins } from "../../src/helpers/channels/get_pins.ts"; import { getPins } from "../../src/helpers/channels/get_pins.ts";
import { DiscordenoMessage } from "../../src/structures/message.ts"; import { sendMessage } from "../../src/helpers/messages/send_message.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[channel] get pins.", name: "[channel] get pins.",
+3 -7
View File
@@ -1,13 +1,9 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { isChannelSynced } from "../../src/helpers/channels/is_channel_synced.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { startTyping } from "../../src/helpers/channels/start_typing.ts"; import { startTyping } from "../../src/helpers/channels/start_typing.ts";
import { assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[channel] is typing.", name: "[channel] is typing.",
+3 -8
View File
@@ -1,14 +1,9 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { isChannelSynced } from "../../src/helpers/channels/is_channel_synced.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { startTyping } from "../../src/helpers/channels/start_typing.ts";
import { swapChannels } from "../../src/helpers/channels/swap_channels.ts"; import { swapChannels } from "../../src/helpers/channels/swap_channels.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[channel] swap channels", name: "[channel] swap channels",
+4 -9
View File
@@ -1,15 +1,10 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { isChannelSynced } from "../../src/helpers/channels/is_channel_synced.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { startTyping } from "../../src/helpers/channels/start_typing.ts";
import { createInvite } from "../../src/helpers/invites/create_invite.ts"; import { createInvite } from "../../src/helpers/invites/create_invite.ts";
import { getInvite } from "../../src/helpers/invites/get_invite.ts"; import { getInvite } from "../../src/helpers/invites/get_invite.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[invite] create invite", name: "[invite] create invite",
@@ -33,7 +28,7 @@ Deno.test({
const invite = await createInvite(channel.id, { const invite = await createInvite(channel.id, {
maxAge: 86400, maxAge: 86400,
maxUses: 0, maxUses: 0,
temporary: false, // @ts-ignore temporary: false,
unique: false, unique: false,
}); });
+4 -10
View File
@@ -1,17 +1,11 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { isChannelSynced } from "../../src/helpers/channels/is_channel_synced.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { startTyping } from "../../src/helpers/channels/start_typing.ts";
import { createInvite } from "../../src/helpers/invites/create_invite.ts"; import { createInvite } from "../../src/helpers/invites/create_invite.ts";
import { getInvite } from "../../src/helpers/invites/get_invite.ts";
import { deleteInvite } from "../../src/helpers/invites/delete_invite.ts"; import { deleteInvite } from "../../src/helpers/invites/delete_invite.ts";
import { getChannelInvites } from "../../src/helpers/invites/get_channel_invites.ts"; import { getChannelInvites } from "../../src/helpers/invites/get_channel_invites.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[invite] delete invite", name: "[invite] delete invite",
@@ -35,7 +29,7 @@ Deno.test({
const invite = await createInvite(channel.id, { const invite = await createInvite(channel.id, {
maxAge: 86400, maxAge: 86400,
maxUses: 0, maxUses: 0,
temporary: false, // @ts-ignore temporary: false,
unique: false, unique: false,
}); });
+5 -12
View File
@@ -1,17 +1,10 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { isChannelSynced } from "../../src/helpers/channels/is_channel_synced.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { startTyping } from "../../src/helpers/channels/start_typing.ts";
import { createInvite } from "../../src/helpers/invites/create_invite.ts"; import { createInvite } from "../../src/helpers/invites/create_invite.ts";
import { getInvite } from "../../src/helpers/invites/get_invite.ts";
import { getChannelInvites } from "../../src/helpers/invites/get_channel_invites.ts"; import { getChannelInvites } from "../../src/helpers/invites/get_channel_invites.ts";
import { delay } from "../../src/util/utils.ts"; import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[invite] get channel invites", name: "[invite] get channel invites",
@@ -35,7 +28,7 @@ Deno.test({
const invite = await createInvite(channel.id, { const invite = await createInvite(channel.id, {
maxAge: 86400, maxAge: 86400,
maxUses: 0, maxUses: 0,
temporary: false, // @ts-ignore temporary: false,
unique: false, unique: false,
}); });
@@ -45,7 +38,7 @@ Deno.test({
const secondInvite = await createInvite(channel.id, { const secondInvite = await createInvite(channel.id, {
maxAge: 32400, maxAge: 32400,
maxUses: 5, maxUses: 5,
temporary: true, // @ts-ignore temporary: true,
unique: true, unique: true,
}); });
+4 -9
View File
@@ -1,15 +1,10 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { createChannel } from "../../src/helpers/channels/create_channel.ts"; import { createChannel } from "../../src/helpers/channels/create_channel.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { delayUntil } from "../util/delay_until.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { isChannelSynced } from "../../src/helpers/channels/is_channel_synced.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { botId } from "../../src/bot.ts";
import { DiscordOverwriteTypes } from "../../src/types/channels/overwrite_types.ts";
import { startTyping } from "../../src/helpers/channels/start_typing.ts";
import { createInvite } from "../../src/helpers/invites/create_invite.ts"; import { createInvite } from "../../src/helpers/invites/create_invite.ts";
import { getInvite } from "../../src/helpers/invites/get_invite.ts"; import { getInvite } from "../../src/helpers/invites/get_invite.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
Deno.test({ Deno.test({
name: "[invite] get invite", name: "[invite] get invite",
@@ -33,7 +28,7 @@ Deno.test({
const invite = await createInvite(channel.id, { const invite = await createInvite(channel.id, {
maxAge: 86400, maxAge: 86400,
maxUses: 0, maxUses: 0,
temporary: false, // @ts-ignore temporary: false,
unique: false, unique: false,
}); });
+3 -2
View File
@@ -1,8 +1,8 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { sendMessage } from "../../src/helpers/messages/send_message.ts"; import { sendMessage } from "../../src/helpers/messages/send_message.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts"; import { delayUntil } from "../util/delay_until.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
async function ifItFailsBlameWolf( async function ifItFailsBlameWolf(
type: "getter" | "raw", type: "getter" | "raw",
@@ -11,6 +11,7 @@ async function ifItFailsBlameWolf(
const channel = cache.channels.get(tempData.channelId); const channel = cache.channels.get(tempData.channelId);
assertExists(channel); assertExists(channel);
// deno-lint-ignore no-explicit-any
let messageContent: any = "Hello World!"; let messageContent: any = "Hello World!";
let secondMessageId = undefined; let secondMessageId = undefined;
if (content === "embed") { if (content === "embed") {
+1
View File
@@ -1,3 +1,4 @@
// deno-lint-ignore require-await
export async function delayUntil( export async function delayUntil(
maxMs: number, maxMs: number,
isReady: () => boolean | undefined, isReady: () => boolean | undefined,
-1
View File
@@ -4,7 +4,6 @@ import { deleteServer } from "../../src/helpers/guilds/delete_server.ts";
import { delay } from "../../src/util/utils.ts"; import { delay } from "../../src/util/utils.ts";
import { ws } from "../../src/ws/ws.ts"; import { ws } from "../../src/ws/ws.ts";
import { assertExists } from "../deps.ts"; import { assertExists } from "../deps.ts";
import { delayUntil } from "../util/delay_until.ts";
// Set necessary settings // Set necessary settings
// Disables the logger which logs everything // Disables the logger which logs everything