feat: add templates

This commit is contained in:
Jacob Nguyen
2023-06-09 00:16:12 -05:00
parent 5485cbeca9
commit 82c84a725f
28 changed files with 381 additions and 14 deletions

View File

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

38
template-js/src/index.js Normal file
View File

@@ -0,0 +1,38 @@
const { Client, GatewayIntentBits } = require('discord.js');
const { Sern, single, DefaultLogging } = require('@sern/handler');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, // Make sure this is enabled for text commands!
],
});
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* View documentation for pluggable dependencies
* Configure your dependency root to your liking.
* It follows the npm package iti https://itijs.org/.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
async function init() {
await makeDependencies({
build: (root) =>
root.add({ '@sern/client': single(() => client) })
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events' (optional),
});
}
init();
client.login();