community-relations/src/main.ts

29 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-04-17 20:31:24 -04:00
/* DM Ramirez with the code below to claim 500 free Rubies!
d2c3d8e14b
*/
2020-12-01 21:58:11 -05:00
import sdNotify from 'sd-notify';
2020-04-14 13:15:33 -04:00
import { parse } from 'yaml';
import { promises as fs } from 'fs';
import { Client } from './class';
2020-05-21 04:33:48 -04:00
import * as eventFiles from './events';
import * as commandFiles from './commands';
2020-07-19 18:04:04 -04:00
import { Config } from '../types'; // eslint-disable-line
2020-04-14 13:15:33 -04:00
async function main(): Promise<void> {
2020-12-01 21:58:45 -05:00
if (process.env.PRODUCTION) {
sdNotify.ready();
sdNotify.startWatchdogMode(2500);
}
2020-04-14 13:15:33 -04:00
const read = await fs.readFile('../config.yaml', 'utf8');
2020-07-19 18:04:04 -04:00
const config: Config = parse(read);
2020-10-28 19:44:31 -04:00
const client = new Client(config.token, { defaultImageFormat: 'png', restMode: true, intents: ['guildBans', 'guildEmojis', 'guildInvites', 'guildMembers', 'guildMessageReactions', 'guildMessages', 'guildPresences', 'guildWebhooks', 'guilds', 'directMessages'] });
2020-04-14 13:15:33 -04:00
client.config = config;
await client.loadDatabase();
2020-04-14 13:15:33 -04:00
client.loadPlugins();
2020-05-21 04:33:48 -04:00
await client.loadEvents(eventFiles);
await client.loadCommands(commandFiles);
2020-04-14 13:15:33 -04:00
client.connect();
}
main();