Skip to content

Commit 8b0fc5e

Browse files
committed
Problem: Cannot search for papers/issues exclusively.
Solution: Handle "serach papers" and "search issues" commands.
1 parent 3c54a12 commit 8b0fc5e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,17 @@ app.message(/.*/, async ({ context, event, say }) => {
156156
}
157157
if (mentioned || event.channel_type === 'im') {
158158
if (words[0] === 'search') {
159+
let text = '';
160+
if (words[1] === 'papers') {
161+
text = search({ query: words.slice(2).join(' '), type: "paper" });
162+
} else if (words[1] === 'issues') {
163+
text = search({ query: words.slice(2).join(' '), type: "issue" });
164+
} else {
165+
text = search({ query: words.slice(1).join(' ') });
166+
}
167+
159168
await say({
160-
text: search({ query: words.slice(1).join(' ') }),
169+
text: text,
161170
unfurl_links: false,
162171
unfurl_media: false,
163172
thread_ts: event.thread_ts

0 commit comments

Comments
 (0)