Yet another Fluxer bot built with TypeScript and Bun
at feat/sqlite 28 lines 769 B view raw
1import { z } from "zod"; 2import type { Message } from "@fluxerjs/core"; 3import { arg } from "@/args"; 4import { Command } from "@/decorators/command"; 5import { RequireNonBot } from "@/decorators/guards"; 6import type { BotContext, ICommand, ParsedArgs } from "../types"; 7 8const echoArgs = { 9 content: arg.restRequired(z.string().min(1).max(2000)), 10} as const; 11 12@Command({ 13 name: "echo", 14 aliases: ["say", "print"], 15 description: "Repeats the content of the message", 16}) 17@RequireNonBot() 18export class EchoCommand implements ICommand<typeof echoArgs> { 19 readonly args = echoArgs; 20 21 async execute( 22 _ctx: BotContext, 23 message: Message, 24 args: ParsedArgs<typeof echoArgs>, 25 ): Promise<void> { 26 await message.channel?.send({ content: args.content }); 27 } 28}