Merge branch 'main' into prettier-workflow

This commit is contained in:
ITOH
2021-05-21 17:54:26 +02:00
5 changed files with 13 additions and 18 deletions
+5 -9
View File
@@ -2,7 +2,6 @@ import { cacheHandlers } from "../../cache.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts"; import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import type { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts"; import type { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts";
import { Errors } from "../../types/discordeno/errors.ts"; import { Errors } from "../../types/discordeno/errors.ts";
import { bigintToSnowflake } from "../../util/bigint.ts";
import { calculatePermissions } from "../../util/permissions.ts"; import { calculatePermissions } from "../../util/permissions.ts";
import { helpers } from "../mod.ts"; import { helpers } from "../mod.ts";
@@ -23,23 +22,20 @@ export async function cloneChannel(channelId: bigint, reason?: string) {
...channelToClone, ...channelToClone,
name: channelToClone.name!, name: channelToClone.name!,
topic: channelToClone.topic || undefined, topic: channelToClone.topic || undefined,
parentId: channelToClone.parentId permissionOverwrites: channelToClone.permissionOverwrites.map((
? bigintToSnowflake(channelToClone.parentId) overwrite,
: undefined, ) => ({
permissionOverwrites: channelToClone.permissionOverwrites.map(
(overwrite) => ({
id: overwrite.id.toString(), id: overwrite.id.toString(),
type: overwrite.type, type: overwrite.type,
allow: calculatePermissions(overwrite.allow.toString()), allow: calculatePermissions(overwrite.allow.toString()),
deny: calculatePermissions(overwrite.deny.toString()), deny: calculatePermissions(overwrite.deny.toString()),
}) })),
),
}; };
//Create the channel (also handles permissions) //Create the channel (also handles permissions)
return await helpers.createChannel( return await helpers.createChannel(
channelToClone.guildId!, channelToClone.guildId!,
createChannelOptions, createChannelOptions,
reason reason,
); );
} }
+1 -1
View File
@@ -20,7 +20,7 @@ export interface CreateGuildChannel {
/** The channel's permission overwrites */ /** The channel's permission overwrites */
permissionOverwrites?: Overwrite[]; permissionOverwrites?: Overwrite[];
/** Id of the parent category for a channel */ /** Id of the parent category for a channel */
parentId?: string; parentId?: bigint;
/** Whether the channel is nsfw */ /** Whether the channel is nsfw */
nsfw?: boolean; nsfw?: boolean;
} }
+1 -1
View File
@@ -79,7 +79,7 @@ export interface Message {
/** Message flags combined as a bitfield */ /** Message flags combined as a bitfield */
flags?: number; flags?: number;
/** The stickers sent with the message (bots currently can only receive messages with stickers, not send) */ /** The stickers sent with the message (bots currently can only receive messages with stickers, not send) */
stickers?: MessageSticker; stickers?: MessageSticker[];
/** /**
* The message associated with the `message_reference` * The message associated with the `message_reference`
* Note: This field is only returned for messages with a `type` of `19` (REPLY). If the message is a reply but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted. * Note: This field is only returned for messages with a `type` of `19` (REPLY). If the message is a reply but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted.
+1 -2
View File
@@ -1,7 +1,6 @@
import { cache } from "../../src/cache.ts"; import { cache } from "../../src/cache.ts";
import { categoryChildren, createChannel } from "../../src/helpers/mod.ts"; import { categoryChildren, createChannel } from "../../src/helpers/mod.ts";
import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts"; import { DiscordChannelTypes } from "../../src/types/channels/channel_types.ts";
import { bigintToSnowflake } from "../../src/util/bigint.ts";
import { assertExists } from "../deps.ts"; import { 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"; import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
@@ -30,7 +29,7 @@ Deno.test({
channelsToCreate.map((num) => channelsToCreate.map((num) =>
createChannel(tempData.guildId, { createChannel(tempData.guildId, {
name: `Discordeno-test-${num}`, name: `Discordeno-test-${num}`,
parentId: bigintToSnowflake(category.id), parentId: category.id,
}) })
) )
); );
+1 -1
View File
@@ -39,7 +39,7 @@ Deno.test({
const channel = await createChannel(tempData.guildId, { const channel = await createChannel(tempData.guildId, {
name: "synced-channel", name: "synced-channel",
parentId: category.id.toString(), parentId: category.id,
}); });
// Assertions // Assertions