Skip to content

Commit

Permalink
🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoder committed Jul 10, 2022
1 parent e69cd4e commit 465015e
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 1 deletion.
143 changes: 143 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"bottleneck": "^2.19.5",
"cheerio": "^1.0.0-rc.3",
"chrono-node": "^2.2.4",
"css-validator": "^0.11.0",
"dotenv": "^10.0.0",
"form-data": "^3.0.0",
"haiku-detect": "^1.1.0",
Expand Down
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import interactionReportForm from "./interactions/reportForm";
import interactionReportFormSubmit from "./interactions/reportFormSubmit";
import interactionEmail from "./interactions/email";
import interactionHaiku from "./interactions/haiku";
import interactionCSS from "./interactions/css";

export const bugsnagClient = bugsnag(process.env.BUGSNAG_API_KEY);

Expand Down Expand Up @@ -183,7 +184,10 @@ controller.hears(
controller.hears(".*", "direct_message,indirect_mention,direct_mention", interactionCatchall);

// catch-all for any message in slack
controller.hears(".*", "ambient", interactionHaiku);
controller.hears(".*", "ambient", (bot, message) =>{
interactionHaiku(bot, message)
interactionCSS(bot, message)
});

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

Expand Down
13 changes: 13 additions & 0 deletions src/interactions/css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { reaction } from "../utils"
let validateCss = require('css-validator');

const interactionHaiku = async (bot, message) => {
const { text, ts } = message
validateCss({text}, async function (_, data) {
if(data.validity){
await reaction(bot, 'add', channel, ts, 'art')
}
});
}

export default interactionHaiku

0 comments on commit 465015e

Please sign in to comment.