Dough Git

clove/inviteTracker

src/utils/logging.ts

back to src/utils

/* src/utils/logging.ts */

import type { Guild } from "discord.js";

export async function logInvite(
  guild: Guild,
  channelId: string,
  content: string,
) {
  const channel = await guild.channels.fetch(channelId);

  if (!channel?.isSendable()) {
    throw new Error(
      "LOGGING_CHANNEL_ID must identify a sendable guild channel",
    );
  }

  await channel.send({
    content,
    allowedMentions: { parse: [] },
  });
}