Skip to content

Commit

Permalink
Add haiku reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwofford committed Mar 2, 2022
1 parent e22a95d commit ad8205b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/interactions/haiku.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { transcript } from "../utils"
import { reaction, transcript } from "../utils"
import { format } from "haiku-detect"

const interactionHaiku = (bot, message) => {
const { text, user } = message
const interactionHaiku = async (bot, message) => {
const { text, user, ts } = message
const noLineText = text.replace(/\n/g, ' ')
const haikuLines = format(noLineText)
if (haikuLines.length == 3) {
bot.replyInThread(message, transcript('haiku', { haikuLines, user }))
await bot.replyInThread(message, transcript('haiku', { haikuLines, user }))
await reaction(bot, 'add', channel, ts, 'haiku')
}
}

Expand Down

0 comments on commit ad8205b

Please sign in to comment.