Skip to content

Instantly share code, notes, and snippets.

@html5cat
Last active December 22, 2016 22:00
Show Gist options
  • Save html5cat/e460602d02c1117f3e7ff27a0668bfd2 to your computer and use it in GitHub Desktop.
Save html5cat/e460602d02c1117f3e7ff27a0668bfd2 to your computer and use it in GitHub Desktop.
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