mirror of
https://github.com/SrIzan10/templates.git
synced 2026-05-01 11:05:17 +00:00
feat: add esm template (#13)
This commit is contained in:
1
templates/javascript-esm/.gitignore
vendored
Normal file
1
templates/javascript-esm/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/node_modules
|
||||
1
templates/javascript-esm/README.md
Normal file
1
templates/javascript-esm/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# TODO
|
||||
23
templates/javascript-esm/package.json
Normal file
23
templates/javascript-esm/package.json
Normal 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"
|
||||
}
|
||||
11
templates/javascript-esm/src/commands/ping.js
Normal file
11
templates/javascript-esm/src/commands/ping.js
Normal 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 🏓');
|
||||
},
|
||||
});
|
||||
20
templates/javascript-esm/src/index.js
Normal file
20
templates/javascript-esm/src/index.js
Normal 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();
|
||||
@@ -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"
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user