Fix Command-Not-Found-ing

This commit is contained in:
Sage Vaillancourt 2022-03-03 14:26:21 -05:00
parent aadb57ecb5
commit 0476720a54
2 changed files with 5 additions and 2 deletions

View File

@ -126,8 +126,11 @@ command(
slack.onMessage(async ({ event, say }) => { slack.onMessage(async ({ event, say }) => {
const words = event?.text?.split(/\s+/) || [] const words = event?.text?.split(/\s+/) || []
const c = commands.get(words[0]) const c = commands.get(words[0])
if (!words[0]?.startsWith('!')) {
return
}
if (!c?.condition(event.user)) { if (!c?.condition(event.user)) {
await say(`Command '${words[0]} not found'`) await say(`Command '${words[0]}' not found`)
return return
} }
if (words[1] === 'help') { if (words[1] === 'help') {

View File

@ -1,4 +1,4 @@
require('./connect4') require('./connect4')
require('./tictactoe') require('./tictactoe')
require('./jokes') require('./jokes')
require('./coins') require('./hvacoins')