Advertisement
cha0s

!img disambiguation for reddichat bot

Jul 26th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             matcher = new RegExp "^#{args}"
  2.             potentials = []
  3.             for k, v of map
  4.                 potentials.push k if k.match matcher
  5.                
  6.             if potentials.length is 1
  7.                 redibot.sendMessage channel, map[potentials[0]]
  8.             else
  9.                 redibot.sendMessage channel, "You could have meant: #{potentials.join ', '}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement