mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
Merge branch 'main' of https://github.com/discordeno/discordeno into main
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
calculateBits,
|
||||
requireOverwritePermissions,
|
||||
} from "../../util/permissions.ts";
|
||||
import { camelKeysToSnakeCase } from "../../util/utils.ts";
|
||||
import { snakelize } from "../../util/utils.ts";
|
||||
|
||||
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
|
||||
export async function createChannel(
|
||||
@@ -34,7 +34,7 @@ export async function createChannel(
|
||||
"post",
|
||||
endpoints.GUILD_CHANNELS(guildId),
|
||||
{
|
||||
...camelKeysToSnakeCase<DiscordCreateGuildChannel>(options ?? {}),
|
||||
...snakelize<DiscordCreateGuildChannel>(options ?? {}),
|
||||
permission_overwrites: options?.permissionOverwrites?.map((perm) => ({
|
||||
...perm,
|
||||
allow: calculateBits(perm.allow),
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
requireBotChannelPermissions,
|
||||
requireOverwritePermissions,
|
||||
} from "../../util/permissions.ts";
|
||||
import { camelKeysToSnakeCase, hasOwnProperty } from "../../util/utils.ts";
|
||||
import { hasOwnProperty, snakelize } from "../../util/utils.ts";
|
||||
|
||||
//TODO: implement DM group channel edit
|
||||
//TODO(threads): check thread perms
|
||||
@@ -88,7 +88,7 @@ export async function editChannel(
|
||||
}
|
||||
|
||||
const payload = {
|
||||
...camelKeysToSnakeCase<Record<string, unknown>>(options),
|
||||
...snakelize<Record<string, unknown>>(options),
|
||||
// deno-lint-ignore camelcase
|
||||
permission_overwrites:
|
||||
hasOwnProperty<ModifyChannel>(options, "permissionOverwrites")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { rest } from "../../../rest/rest.ts";
|
||||
import { ListPublicArchivedThreads } from "../../../types/channels/threads/list_public_archived_threads.ts";
|
||||
import { endpoints } from "../../../util/constants.ts";
|
||||
import { camelKeysToSnakeCase } from "../../../util/utils.ts";
|
||||
import { snakelize } from "../../../util/utils.ts";
|
||||
|
||||
export async function getArchivedThreads(
|
||||
channelId: bigint,
|
||||
@@ -19,6 +19,6 @@ export async function getArchivedThreads(
|
||||
: options?.type === "private"
|
||||
? endpoints.THREAD_ARCHIVED_PRIVATE(channelId)
|
||||
: endpoints.THREAD_ARCHIVED_PUBLIC(channelId),
|
||||
camelKeysToSnakeCase(options ?? {}),
|
||||
snakelize(options ?? {}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ChannelTypes } from "../../../types/channels/channel_types.ts";
|
||||
import { StartThread } from "../../../types/channels/threads/start_thread.ts";
|
||||
import { Errors } from "../../../types/discordeno/errors.ts";
|
||||
import { endpoints } from "../../../util/constants.ts";
|
||||
import { camelKeysToSnakeCase } from "../../../util/utils.ts";
|
||||
import { snakelize } from "../../../util/utils.ts";
|
||||
|
||||
/**
|
||||
* Creates a new public thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.
|
||||
@@ -33,6 +33,6 @@ export async function startThread(
|
||||
options?.messageId
|
||||
? endpoints.THREAD_START_PUBLIC(channelId, options.messageId)
|
||||
: endpoints.THREAD_START_PRIVATE(channelId),
|
||||
camelKeysToSnakeCase(options),
|
||||
snakelize(options),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user