Skip to content

Commit

Permalink
Add gamelab autoreply
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwofford committed Feb 11, 2022
1 parent b2b4a26 commit 372af84
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ controller.hears(
);

// catch-all for direct messages
controller.hears(".*", "direct_message,indirect_mention,direct_mention", interactionCatchall);
// controller.hears(".*", "direct_message,indirect_mention,direct_mention", interactionCatchall);

controller.hears(".*", "direct_message,indirect_mention,direct_mention", interactionGamelab)

controller.on("view_submission", async (bot, message) => {
bot.replyAcknowledge();
Expand Down
17 changes: 17 additions & 0 deletions src/interactions/gamelab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { transcript, getInfoForUser, reaction } from '../utils'

const interactionGamelab = (bot, message) => {
const { ts: timestamp, channel, user } = message

getInfoForUser(user).then(({ slackUser }) => {
if (slackUser.is_bot) {
bot.replyInThread(message, transcript('catchall.botReply'))
} else {
bot.replyInThread(message, transcript('gamelab.autoReply'))
reaction(bot, 'add', channel, timestamp, transcript('gamelab.gamelabEmoji'))
reaction(bot, 'add', channel, timestamp, transcript('gamelab.warningEmoji'))
}
})
}

export default interactionGamelab
6 changes: 6 additions & 0 deletions src/utils/transcript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,9 @@ wildWildWest:
olympics:
ticket: |
Welcome to the games <@${this.user}>! We're so excited to have you join us, check your email for more details!
gamelab:
autoReply: |
_I've set an auto-reply using <@U017VA2PN3V> until <!date^${Date.parse(2022, 02, 25)}^{date_short_pretty}|on Fri, Feb 25th>_
<https://hackclub.slack.com/archives/C0P5NE354/p1644606215597029|HELP!!!1!>
gamelabEmoji: gamelab
warningEmoji: warning

0 comments on commit 372af84

Please sign in to comment.