reformatted to use my template
This commit is contained in:
33
src/main.ts
Normal file
33
src/main.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Client, Intents } from 'discord.js';
|
||||
import { initClient } from 'discordslash';
|
||||
import Lang from 'lang';
|
||||
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
||||
import SetLang from './lang';
|
||||
import { initRolemanager } from './rolemanager';
|
||||
|
||||
//init logs with a timestamp
|
||||
console.log(new Date().toISOString()+'\n\n');
|
||||
|
||||
SetLang();
|
||||
|
||||
//get token
|
||||
if (!existsSync('./token.txt')) {
|
||||
writeFileSync('./token.txt', '');
|
||||
console.error(Lang.get('error.main.missingToken'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const TOKEN = readFileSync('./token.txt').toString(),
|
||||
CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
||||
|
||||
initClient(CLIENT);
|
||||
initRolemanager(CLIENT);
|
||||
|
||||
//discord connections
|
||||
CLIENT.on('ready', client => {
|
||||
console.log(Lang.get('main.login', {
|
||||
user: client.user.tag
|
||||
}));
|
||||
});
|
||||
|
||||
CLIENT.login(TOKEN);
|
||||
Reference in New Issue
Block a user