1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { command_processor } from "https://esm.town/v/curtcox/command_processor?v=14";
function tail(text: string): string {
const trimmed = text.trimStart();
const index = trimmed.indexOf(" ");
if (index !== -1) {
return trimmed.substring(index + 1);
} else {
return "";
}
}
export const processor = async (body) => {
// const text = JSON.stringify(body);
console.log("command processor " + body);
const command = tail(body.event.text); // discard user
return command_processor(command);
};