Last active
December 22, 2016 22:00
-
-
Save html5cat/e460602d02c1117f3e7ff27a0668bfd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {Feature} = require('other') | |
const cats = getCatEmoji() | |
module.exports = new Feature({ | |
name: 'Cat', | |
version: '0.0.1', | |
dependencies: { | |
otherjs: '3.x', | |
}, | |
listeners: [{ | |
to: {words: ['cat']}, | |
on({word, rest}) { | |
// const query = rest.toLowerCase().replace(word, '').trim() | |
// let shuffledCats = cats.sort(() => 0.5 - Math.random()) | |
// if (query.length) { | |
// const sampleSize = Math.round(cats.length / Math.pow(query.length, 2)) | |
// shuffledCats = shuffledCats.slice(0, sampleSize) | |
// } | |
return {chatCompletions: cats.map((cat) => ({text: cat, format: 'h1'}))} | |
}, | |
}], | |
}) | |
function getCatEmoji() { | |
return [ | |
'๐', | |
'๐ฑ', | |
'๐ป', | |
'๐น', | |
'๐', | |
'๐ผ', | |
'๐ฝ', | |
'๐ธ', | |
'๐ฟ', | |
'๐บ', | |
'๐พ', | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment