Goal
This walkthrough will be written in TypeScript but will have JavaScript snippets throughout.
Make robust, modular, bots
- Modularity: sern is built with modularity in mind. You can swap pieces and parts easily.
- Familiar: Commands and structures are similar to classic v12 handlers and the official Discord.js command handler guide, while packing many features!
- Concise: Too much code is a liability. With sern, write less for more. 🤯
Why sern?
1import { Command } from "@sapphire/framework";2import type { CommandInteraction } from "discord.js";3
4export class PingCommand extends Command {5 public constructor(context: Command.Context) {6 super(context, {7 description: "Pong!",8 chatInputCommand: {9 register: true,10 },11 });12 }13 public async chatInputRun(interaction: CommandInteraction) {14 await interaction.reply("Pong!");15 }16}
1import { commandModule, CommandType } from "@sern/handler";2
3export default commandModule({4 type: CommandType.Both,5 description: "Pong!",6 execute: async (ctx, args) => {7 await ctx.reply("Pong!");8 },9});
Keep in mind the sern example acts as both a slash command AND a text command. The Sapphire example is only a slash command, and it’s more code than sern.