
I'm trying to write a script that eventually prompts the user to select a token. Specifics aren't that important; I've already found a workaround, now I just want to understand how the API works :) Simplified version: on("chat:message", msg => { const [cmd, args] = msg.content.split(" ");
log({cmd}); switch (cmd.toLowerCase()) { case '!input': {
// if content is unescaped i get this error:
// "ERROR: Unable to find character target in chat command." sendChat(msg.who, `!output ${escape("@{target|token_id}")}`); break; } case '!output': { log({args});
break; } } }) Console output: {"cmd":"!input"} {"cmd":"!output"} {"args":"@{target|token_id}"} So it looks like messages delivered via API aren't interpreted in quite the same way as they are via the chat box. For the record, my current workaround is to return a button with a macro: "[select token](!
#run-output)" But I'm specifically asking if there's a way to eliminate the additional button click. Is there a way to accomplish this?