mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-12-02 19:02:50 +08:00
feat(open-protocol): add OpenProtocol v1 discovery and slash-command support
This commit is contained in:
1 parent
17008ae52e
commit
263c1ba6da
16 files changed
+1359
-183
No files matched your search
@@ -29,7 +29,11 @@ function withFakeClient(
|
||||
): string[] {
|
||||
const calls: string[] = [];
|
||||
const fake = {
|
||||
execCommandWithResponse: vi.fn(async (cmd: string) => {
|
||||
send: vi.fn(async (req: { command: string; params?: readonly (readonly [string, unknown])[] }) => {
|
||||
const paramPairs = (req.params ?? [])
|
||||
.filter(([, v]) => v !== undefined)
|
||||
.map(([k, v]) => `${k}=${String(v)}`);
|
||||
const cmd = paramPairs.length > 0 ? `${req.command} ${paramPairs.join(" ")}` : req.command;
|
||||
calls.push(cmd);
|
||||
return respond(cmd);
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user