mirror of
https://github.com/sern-handler/create-bot
synced 2026-06-06 01:16:53 +00:00
@@ -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",
|
||||
@@ -16,7 +17,8 @@
|
||||
"dependencies": {
|
||||
"@sern/handler": "^3.0.3",
|
||||
"discord.js": "latest",
|
||||
"dotenv": "^16.3.1"
|
||||
"dotenv": "^16.3.1",
|
||||
"@sern/publisher": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.0.25"
|
||||
|
||||
13
template-js/src/config.js
Normal file
13
template-js/src/config.js
Normal 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 = '?'
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/// <reference path="dependencies.d.ts" />
|
||||
import 'dotenv/config'
|
||||
import * as config from './config.js'
|
||||
import { Client, GatewayIntentBits } from 'discord.js';
|
||||
import { Sern, single, makeDependencies } from '@sern/handler';
|
||||
import { Sern, makeDependencies } from '@sern/handler';
|
||||
import { Publisher } from '@sern/publisher'
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
@@ -19,14 +21,12 @@ const client = new Client({
|
||||
* This is used for external event modules as well
|
||||
*/
|
||||
await makeDependencies(({ add }) => {
|
||||
add('@sern/client', single(() => client));
|
||||
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();
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
"dependencies": {
|
||||
"@sern/handler": "^3.0.3",
|
||||
"discord.js": "latest",
|
||||
"dotenv": "^16.3.1"
|
||||
"dotenv": "^16.3.1",
|
||||
"@sern/publisher": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.25",
|
||||
|
||||
13
template-ts/src/config.ts
Normal file
13
template-ts/src/config.ts
Normal 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 = '?'
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import 'dotenv/config'
|
||||
import * as config from './config.js'
|
||||
import { Client, GatewayIntentBits } from 'discord.js';
|
||||
import { Sern, single, makeDependencies } from '@sern/handler';
|
||||
|
||||
import { Sern, makeDependencies } from '@sern/handler';
|
||||
import { Publisher } from '@sern/publisher'
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
@@ -19,14 +20,11 @@ const client = new Client({
|
||||
* This is used for external event modules as well
|
||||
*/
|
||||
await makeDependencies(({ add }) => {
|
||||
add('@sern/client', single(() => client));
|
||||
add('@sern/client', client);
|
||||
add('publisher', new Publisher());
|
||||
});
|
||||
|
||||
//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()
|
||||
|
||||
Reference in New Issue
Block a user