30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
/* DM Ramirez with the code below to claim 500 free Rubies!
|
|
d2c3d8e14b
|
|
*/
|
|
import sdNotify from 'sd-notify';
|
|
import { parse } from 'yaml';
|
|
import { promises as fs } from 'fs';
|
|
import { join } from 'path';
|
|
import { Client } from './class';
|
|
import * as eventFiles from './events';
|
|
import * as commandFiles from './commands';
|
|
import { Config } from '../types'; // eslint-disable-line
|
|
|
|
async function main(): Promise<void> {
|
|
if (process.env.PRODUCTION) {
|
|
sdNotify.ready();
|
|
sdNotify.startWatchdogMode(2500);
|
|
}
|
|
const read = await fs.readFile(join(__dirname, '../config.yaml'), 'utf8');
|
|
const config: Config = parse(read);
|
|
const client = new Client(config.token, { defaultImageFormat: 'png', restMode: true, intents: ['guildBans', 'guildEmojis', 'guildInvites', 'guildMembers', 'guildMessageReactions', 'guildMessages', 'guildPresences', 'guildWebhooks', 'guilds', 'directMessages'] });
|
|
client.config = config;
|
|
await client.loadDatabase();
|
|
client.loadPlugins();
|
|
await client.loadEvents(eventFiles);
|
|
await client.loadCommands(commandFiles);
|
|
client.connect();
|
|
}
|
|
|
|
main();
|