diff --git a/app/server/libs/twitch/chat/onCommand.js b/app/server/libs/twitch/chat/onCommand.js index 34114408..9741ddc5 100644 --- a/app/server/libs/twitch/chat/onCommand.js +++ b/app/server/libs/twitch/chat/onCommand.js @@ -49,10 +49,17 @@ module.exports = async function onCommand({ channel, command, nick, message }) { command.args.push(rest.join(" ")); } + let chatMessage = (commandEntry.message || "").trim(); + argNames.forEach((arg, i) => { args[arg] = command.args[i] || `$${arg}`; + chatMessage = chatMessage.replaceAll(`$${arg}`, args[arg]); }); cooldowns[command.name] = now; pushActions("onCommand", { user: nick, message, command, ...args }); + + if (chatMessage.length) { + this.say(channel, chatMessage); + } }; diff --git a/front-src/client/components/Widgets/Twitch/Commands/EditCommand.svelte b/front-src/client/components/Widgets/Twitch/Commands/EditCommand.svelte index 57b22907..dcbc8577 100644 --- a/front-src/client/components/Widgets/Twitch/Commands/EditCommand.svelte +++ b/front-src/client/components/Widgets/Twitch/Commands/EditCommand.svelte @@ -7,7 +7,7 @@ export let command; function update(key, { target }) { - command[key] = target.value; + command[key] = target.value.trim(); api.updateCommand(command); } @@ -22,7 +22,7 @@ on:change="{update.bind(null, 'name')}" /> @@ -38,6 +38,14 @@ value="{command.cooldown}" on:change="{update.bind(null, 'cooldown')}" /> +
+ {_('words.message')} +
+