Filter words
This commit is contained in:
parent
745fd5c236
commit
bde5a906f7
@ -36,8 +36,10 @@ module.exports = (robot) ->
|
||||
"http://dogr.io/#{escape text}.png?split=false"
|
||||
|
||||
shiba = (res, words) ->
|
||||
word = words.filter (x) -> x.length > 4
|
||||
prefix = [ 'much', 'such', 'many', 'very']
|
||||
word = words.filter (x) ->
|
||||
/^[a-zA-ZàèéìòùÀÈÉÌÒÙ\-_!&@#?]{4,}$/.test x
|
||||
console.log word
|
||||
(res.random prefix) + ' ' + (res.random words)
|
||||
|
||||
run_command = (command, callback) ->
|
||||
@ -59,7 +61,7 @@ module.exports = (robot) ->
|
||||
callback ((match_all regex, lines.join '\n').map parse_line)
|
||||
|
||||
robot.respond /doge(?: (\d+))?/, (res) ->
|
||||
n = res.match[1] || 10
|
||||
n = res.match[1] || 20
|
||||
get_history res.message.room, n, (history) ->
|
||||
words = concat (message.text.split ' ' for message in history)
|
||||
sample = (res.random ['wow', shiba res, words] for _ in [0..8])
|
||||
|
Loading…
Reference in New Issue
Block a user