feat: add esm template (#13)

This commit is contained in:
Jacob Nguyen
2022-08-13 11:26:08 -05:00
committed by GitHub
parent f2632d4317
commit 18d459e486
7 changed files with 60 additions and 4 deletions

1
templates/javascript-esm/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/node_modules

View File

@@ -0,0 +1 @@
# TODO

View File

@@ -0,0 +1,23 @@
{
"name": "js-esm-example",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"javacsript",
"sern",
"discord.js"
],
"license": "UNLICENSED",
"dependencies": {
"@sern/handler": "^1.1.9-beta",
"discord.js": "^14.2.0"
},
"devDependencies": {
"@types/node": "^17.0.25"
},
"type": "module"
}

View File

@@ -0,0 +1,11 @@
import { CommandType, commandModule } from '@sern/handler';
export default commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
});

View File

@@ -0,0 +1,20 @@
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern } from '@sern/handler';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, // Make sure this is enabled for text commands!
],
});
//View docs for all options
Sern.init({
client,
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events' (optional),
});
client.login();

View File

@@ -13,8 +13,8 @@
],
"license": "UNLICENSED",
"dependencies": {
"@sern/handler": "^1.1.5-beta",
"discord.js": "^14.0.3"
"@sern/handler": "^1.1.9-beta",
"discord.js": "^14.2.0"
},
"devDependencies": {
"@types/node": "^17.0.25"

View File

@@ -13,8 +13,8 @@
],
"license": "UNLICENSED",
"dependencies": {
"@sern/handler": "^1.1.5-beta",
"discord.js": "^14.0.3"
"@sern/handler": "^1.1.9-beta",
"discord.js": "^14.2.0"
},
"devDependencies": {
"@types/node": "^17.0.25",