Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 93f0121

Browse files
committed
Merge pull request #1106 from cobaimelan/master
Added hubble
2 parents 763b9a0 + 7f3d9f3 commit 93f0121

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/scripts/hubble.coffee

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Description:
3+
# Hubble Movie information is displayed.
4+
#
5+
# Dependencies:
6+
# None
7+
#
8+
# Commands:
9+
# hubble me <query> - Movie information is displayed
10+
# hub me <query>
11+
#
12+
# Author:
13+
# cobaimelan
14+
15+
getMovie = (msg) ->
16+
query = msg.match[3]
17+
msg.http('http://hububble.herokuapp.com/movie/?')
18+
.query(q: query)
19+
.get() (err, res, body) ->
20+
results = JSON.parse(body)
21+
if results.eror
22+
msg.send "eror"
23+
return
24+
msg.send "Movie title : #{results.title}"
25+
msg.send "Movie year : #{results.year}"
26+
msg.send "Movie artist : #{results.artist}"
27+
msg.send "Movie description : #{results.desc}"
28+
29+
module.exports = (robot) ->
30+
robot.respond /(hubble|hub)( me)? (.*)/i, (msg) ->
31+
getMovie(msg)

0 commit comments

Comments
 (0)