mirror of
https://github.com/sern-handler/create-bot
synced 2026-06-28 02:32:21 +00:00
feat: add templates
This commit is contained in:
11
template-js/src/commands/ping.js
Normal file
11
template-js/src/commands/ping.js
Normal 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
38
template-js/src/index.js
Normal 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();
|
||||
Reference in New Issue
Block a user