add config file setup, more flexible

This commit is contained in:
jacob
2024-07-16 23:38:14 -05:00
parent 26de63dc4b
commit 1a7df4d292
5 changed files with 34 additions and 12 deletions

13
template-ts/src/config.ts Normal file
View File

@@ -0,0 +1,13 @@
//CONFIG FILE: export only data here and do not cause side effects. Feel free to add your own configuration to this file.
//commands directory. REQUIRED
export const commands = './dist/commands'
// events directory.
export const events = './dist/events'
// schedule tasks and declare them here
export const tasks = './dist/tasks'
// defaultPrefix: if omitted, sern will disable all text/prefix commands
export const defaultPrefix = '?'

View File

@@ -1,4 +1,5 @@
import 'dotenv/config'
import * as config from './config.js'
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, makeDependencies } from '@sern/handler';
import { Publisher } from '@sern/publisher'
@@ -24,10 +25,6 @@ await makeDependencies(({ add }) => {
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'dist/commands',
// events: 'dist/events', //(optional)
});
Sern.init(config);
await client.login()