add: return type

This commit is contained in:
ITOH
2021-06-19 17:13:08 +02:00
parent 5202e3f6ae
commit f3353f512c
7 changed files with 18 additions and 12 deletions
+8 -4
View File
@@ -1,9 +1,11 @@
import { cacheHandlers } from "../../../cache.ts";
import { rest } from "../../../rest/rest.ts";
import { Channel } from "../../../types/channels/channel.ts";
import { StartThread } from "../../../types/channels/threads/start_thread.ts";
import { Errors } from "../../../types/discordeno/errors.ts";
import { endpoints } from "../../../util/constants.ts";
import { requireBotChannelPermissions } from "../../../util/permissions.ts";
import { channelToThread } from "../../../util/transformers/channel_to_thread.ts";
import { snakelize } from "../../../util/utils.ts";
/** Creates a new public thread from an existing message. Returns a thread channel. */
@@ -17,9 +19,11 @@ export async function startThread(channelId: bigint, options: StartThread & { me
await requireBotChannelPermissions(channel, ["SEND_MESSAGES", "USE_PUBLIC_THREADS"]);
}
return await rest.runMethod(
"post",
endpoints.THREAD_START_PUBLIC(channelId, options.messageId),
snakelize(options)
return channelToThread(
await rest.runMethod<Channel>(
"post",
endpoints.THREAD_START_PUBLIC(channelId, options.messageId),
snakelize(options)
)
);
}