Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sneaker Request Data #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions external-scripts.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[
"hubot-help",
"hubot-redis-brain",
"hubot-diagnostics",
"hubot-shipit"
"hubot-help"
]
10 changes: 4 additions & 6 deletions scripts/example.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
#
# These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md
#
# Commands:
# request - Make a sneaker request.

module.exports = (robot) ->

robot.respond /request (.*)/i, (res) ->
shoeRequest = res.match[1]
res.reply "We received your request for #{shoeRequest}"
robot.respond /request (.*)/i, (res) ->
shoeRequest = res.match[1]
res.reply "We received your request for #{shoeRequest}"

# hello = ['hello','hey','hi']

# robot.hear /hello/, (res) ->
# res.send "@everyone: Howdy SNEAKYHEAD Team! My name is Sneakbot I just gotta new look thanks to @bronxzou. I'm here to change the game!"
# res.send "@everyone: Howdy SNEAKYHEAD Team! My name is Sneakbot I just gotta new look thanks to @bronxzou. I'm here to change the game!"

# robot.hear /badger/i, (res) ->
# res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS"
Expand Down
57 changes: 57 additions & 0 deletions scripts/sneakybot-requests.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Description:
# A request system for slack.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# request - Make a sneaker request.
# who is - Return who is the user.
#
# Notes:
#
# Author:
# mrbernnz

module.exports = (robot) ->

# Sending a private message so private informatiion isn't broadcast in a room.
#robot.router.post '/hubot/chatsecrets/:room', (req, res) ->
#room = req.body.room

#robot.logger.info "Message '#{message}' received for room #{room}"

#user = robot.adapter.userForId 'broadcast'
#user.room = room

#if message
#robot.send user, "What's first name?"

#res.writeHead 200, {'Content-Type': 'text/plain'}
#res.end 'Thanks\n'

robot
.respond /request (.*)$/i, (msg) ->
shoeRequest = msg.match[1]
requester = msg.message.user.name

#robot.brain.set 'totalShoeRequests', shoeRequest
msg.send "received your request for #{shoeRequest}"
request = {
"name": requester,
"data": shoeRequest
}

data = JSON.stringify(request)
robot
.http("/profiles/")
.header('Content-Type', 'application/json')
.post(data) (err, res, body) ->
if(err)
res.send "Encountered an error, :( #{err}"
return
else
res.send 'Sent'
34 changes: 0 additions & 34 deletions scripts/welcome.coffee

This file was deleted.