diff --git a/template-js/package.json b/template-js/package.json index 4446ee8..b93100e 100644 --- a/template-js/package.json +++ b/template-js/package.json @@ -3,10 +3,11 @@ "version": "1.0.0", "private": true, "description": "", - "main": "src/index.js", + "main": "dist/index.js", "scripts": { "start": "node .", - "commands:publish": "sern commands publish" + "commands:publish": "sern commands publish", + "build": "sern build" }, "keywords": [ "javascript", diff --git a/template-js/src/config.js b/template-js/src/config.js new file mode 100644 index 0000000..31bdebe --- /dev/null +++ b/template-js/src/config.js @@ -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 = '?' + diff --git a/template-js/src/index.js b/template-js/src/index.js index b9cf272..db04931 100644 --- a/template-js/src/index.js +++ b/template-js/src/index.js @@ -1,5 +1,6 @@ /// 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' @@ -21,14 +22,11 @@ const client = new Client({ */ await makeDependencies(({ add }) => { add('@sern/client', client); + add('publisher', new Publisher()); }); //View docs for all options -Sern.init({ - defaultPrefix: '!', // removing defaultPrefix will shut down text commands - commands: 'src/commands', - // events: 'src/events', //(optional) -}); +Sern.init(config); client.login(); diff --git a/template-ts/src/config.ts b/template-ts/src/config.ts new file mode 100644 index 0000000..31bdebe --- /dev/null +++ b/template-ts/src/config.ts @@ -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 = '?' + diff --git a/template-ts/src/index.ts b/template-ts/src/index.ts index 5b0d9f3..67b47e7 100644 --- a/template-ts/src/index.ts +++ b/template-ts/src/index.ts @@ -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()