all repos — stealth-developers @ 8bee8ce3815083afdc6fb78059396adc11ac73a8

src/discord.ts (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
import { Client, Events, GatewayIntentBits } from "discord.js";
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) => {
	logger.info(`logged in as ${client.user?.tag}!`);

	await Promise.all([registerEvents(client), registerInteractions(client)]);
	logger.info("events and interactions registered!");
	console.log();

	startTicketWatcher(client);
});

export default client;