diff --git a/src/bot.js b/src/bot.js index df4d509..ea9b5fc 100644 --- a/src/bot.js +++ b/src/bot.js @@ -12,11 +12,16 @@ export function makeBot() { client.on("MESSAGE_CREATE", (message) => { if (message.content.startsWith("$ ")) { const command = message.content.substring(2, message.content.length); - handleCommand(command, (_streamName, streamContent) => { + const result = handleCommand(command, (_streamName, streamContent) => { client.api("POST", `/channels/${message.channel_id}/messages`, { content: streamContent }); }); + if (result.error) { + client.api("POST", `/channels/${message.channel_id}/messages`, { + content: `error: ${result.error}` + }); + } } }); diff --git a/src/commands/interperter.js b/src/commands/interperter.js index eea4a55..36dc3ca 100644 --- a/src/commands/interperter.js +++ b/src/commands/interperter.js @@ -191,14 +191,13 @@ export function handleCommand(message, displayFunc) { const { error: tokError, tokens } = tokenize(message); if (tokError) { return { - error: `error: tokenize: ${tokError}` + error: `tokenize: ${tokError}` }; } const { error: insError, instructions } = tokensToInstructions(tokens); - console.log(instructions); if (insError) { return { - error: `error: tokensToInstructions: ${insError}` + error: `tokensToInstructions: ${insError}` }; }