apps/bot/src/index.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 30 31 32 33 34 35 36 37 |
import { GatewayIntentBits } from "discord.js";
import { LogLevel, SapphireClient } from "@sapphire/framework";
import config from "@stealth-developers/config";
import { PinoSapphireLogger } from "$/logger";
import "./commands";
import "./listeners";
import "./preconditions";
const client = new SapphireClient({
logger: {
instance: new PinoSapphireLogger(
{ level: "debug" },
config.isProd ? LogLevel.Info : LogLevel.Debug,
),
},
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
],
baseUserDirectory: null,
});
const main = async () => {
try {
await client.login(config.discord.token);
} catch (error) {
client.logger.fatal(error);
await client.destroy();
process.exit(1);
}
};
void main();
|