mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
Update create_channel.ts
This commit is contained in:
@@ -2,7 +2,7 @@ import { eventHandlers } from "../../bot.ts";
|
|||||||
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 { DiscordChannel } from "../../types/channels/channel.ts";
|
import { Channel } from "../../types/channels/channel.ts";
|
||||||
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
|
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
|
||||||
import {
|
import {
|
||||||
CreateGuildChannel,
|
CreateGuildChannel,
|
||||||
@@ -38,7 +38,7 @@ export async function createChannel(
|
|||||||
// BITRATES ARE IN THOUSANDS SO IF USER PROVIDES 32 WE CONVERT TO 32000
|
// BITRATES ARE IN THOUSANDS SO IF USER PROVIDES 32 WE CONVERT TO 32000
|
||||||
if (options?.bitrate && options.bitrate < 1000) options.bitrate *= 1000;
|
if (options?.bitrate && options.bitrate < 1000) options.bitrate *= 1000;
|
||||||
|
|
||||||
const result = (await rest.runMethod(
|
const result = await rest.runMethod<Channel>(
|
||||||
"post",
|
"post",
|
||||||
endpoints.GUILD_CHANNELS(guildId),
|
endpoints.GUILD_CHANNELS(guildId),
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ export async function createChannel(
|
|||||||
type: options?.type || DiscordChannelTypes.GUILD_TEXT,
|
type: options?.type || DiscordChannelTypes.GUILD_TEXT,
|
||||||
reason,
|
reason,
|
||||||
},
|
},
|
||||||
)) as DiscordChannel;
|
);
|
||||||
|
|
||||||
const discordenoChannel = await structures.createDiscordenoChannel(result);
|
const discordenoChannel = await structures.createDiscordenoChannel(result);
|
||||||
await cacheHandlers.set("channels", discordenoChannel.id, discordenoChannel);
|
await cacheHandlers.set("channels", discordenoChannel.id, discordenoChannel);
|
||||||
|
|||||||
Reference in New Issue
Block a user