Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit 5710667

Browse files
committed
Add simple default message on receiving an unknown command
1 parent 0811a84 commit 5710667

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/events.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ const handlers = {
168168
return appCommandHandlers[appCommand]( event, request );
169169
}
170170

171-
return false;
171+
const defaultMessage = (
172+
'Sorry, I\'m not quite sure what you\'re asking me. I\'m not very smart - there\'s only a ' +
173+
'few things I\'ve been trained to do. Send me `help` for more details.'
174+
);
175+
176+
return slack.sendMessage( defaultMessage, event.channel );
172177

173178
} // AppMention event.
174179
}; // Handlers.

tests/events.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,6 @@ describe( 'handlers.appMention', () => {
197197

198198
});
199199

200-
it( 'returns false if a supported command cannot be found', () => {
201-
const event = {
202-
type: eventType,
203-
text: '<@U00000000> some_command_that_should_not_exist'
204-
};
205-
206-
expect( handlers.appMention( event ) ).toBeFalse();
207-
});
208-
209200
}); // Handlers.appMention.
210201

211202
describe( 'handleEvent', () => {

0 commit comments

Comments
 (0)