mirror of
https://github.com/arthur-pbty/flint.git
synced 2026-08-02 04:37:57 +02:00
- Add `defineCommand` function to validate and normalize command inputs. - Introduce `deployApplicationCommands` for deploying slash commands to Discord. - Create `CommandRegistry` class for managing command registration and retrieval. - Implement `buildSlashPayload` to construct slash command payloads with localization support. - Add usage utilities for prefix and slash commands. - Develop `CommandExecutor` to handle command execution with permission checks and cooldown management. - Create member message rendering service for welcome and leave messages with customizable templates. - Introduce presence template variables for dynamic bot status updates. - Implement template variable utilities for rendering and extracting variables from strings.
20 lines
728 B
TypeScript
20 lines
728 B
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { tokenizePrefixInput } from "../src/core/commands/argParser.js";
|
|
|
|
test("tokenizePrefixInput parse les quotes simples et doubles", () => {
|
|
const tokens = tokenizePrefixInput('"hello world" test \'foo bar\'');
|
|
assert.deepEqual(tokens, ["hello world", "test", "foo bar"]);
|
|
});
|
|
|
|
test("tokenizePrefixInput conserve les tokens non quotes", () => {
|
|
const tokens = tokenizePrefixInput("alpha beta gamma");
|
|
assert.deepEqual(tokens, ["alpha", "beta", "gamma"]);
|
|
});
|
|
|
|
test("tokenizePrefixInput gere les quotes echappees", () => {
|
|
const tokens = tokenizePrefixInput('"say \\"hello\\"" done');
|
|
assert.deepEqual(tokens, ['say "hello"', "done"]);
|
|
});
|