Update follow_channel.ts

This commit is contained in:
ITOH
2021-04-23 23:27:32 +02:00
parent 7f8e67f5c6
commit 82b896d177
+8 -5
View File
@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts"; import { rest } from "../../rest/rest.ts";
import { DiscordFollowedChannel } from "../../types/channels/followed_channel.ts"; import { FollowedChannel } from "../../types/channels/followed_channel.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts";
@@ -10,10 +10,13 @@ export async function followChannel(
) { ) {
await requireBotChannelPermissions(targetChannelId, ["MANAGE_WEBHOOKS"]); await requireBotChannelPermissions(targetChannelId, ["MANAGE_WEBHOOKS"]);
const data = const data = await rest.runMethod<FollowedChannel>(
(await rest.runMethod("post", endpoints.CHANNEL_FOLLOW(sourceChannelId), { "post",
endpoints.CHANNEL_FOLLOW(sourceChannelId),
{
webhook_channel_id: targetChannelId, webhook_channel_id: targetChannelId,
})) as DiscordFollowedChannel; },
);
return data.webhook_id; return data.webhookId;
} }