Skip to content

Instantly share code, notes, and snippets.

@tenten0213
Last active December 26, 2015 11:59
Show Gist options
  • Save tenten0213/7148083 to your computer and use it in GitHub Desktop.
Save tenten0213/7148083 to your computer and use it in GitHub Desktop.
HubotにFizzBuzzを答えさせる
# Description:
# hubot answer the FizzBuzz Question
#
# Commands:
# hubot fizzbuzz N - Reply result of FizzBuzz
module.exports = (robot) ->
robot.respond /fizzbuzz( (\d+))?/i, (msg) ->
count = msg.match[2] || 100
msg.send ['Fizz' unless i%3] + ['Buzz' unless i%5] or i for i in [1..count]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment