import { Client, Events, GatewayIntentBits } from "discord.js"; import { parseArgs } from "util"; import rest from "./rest"; export { rest }; import registerEvents from "./handlers/events.ts"; import registerInteractions from "./handlers/interactions.ts"; import { startTicketWatcher } from "./tasks/ticketWatcher.ts"; import logger from "./utils/logging.ts"; const client = new Client({ intents: [ GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, ], }); client.on(Events.ClientReady, async (client) => { const { values } = parseArgs({ args: Bun.argv, options: { ignoreCommands: { type: "boolean", default: false, short: "i", }, }, strict: true, allowPositionals: true, }); logger.info(`logged in as ${client.user?.tag}!`); if (!values.ignoreCommands) { await Promise.all([registerEvents(client), registerInteractions(client)]); logger.info("events and interactions registered!"); console.log(); } else { logger.warn("ignoring commands"); } startTicketWatcher(client); }); export default client;