FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
hubot-scripts/src/scripts/beeradvocate.coffee at master · github/hubot-scripts · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Jun 8, 2023. It is now read-only.
github
/
hubot-scripts
Public archive
Notifications
You must be signed in to change notification settings
Fork
1.8k
Star
3.5k
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
hubot-scripts
/
src
/
scripts
/
beeradvocate.coffee
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (30 loc) · 1.48 KB
Breadcrumbs
hubot-scripts
/
src
/
scripts
/
beeradvocate.coffee
Copy path
File metadata and controls
32 lines (30 loc) · 1.48 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
Description:
#
An alternate to the existing beer script, this will scrape beer advocate for the most recent accessed beer.
#
It returns the name of the beer, a picture of the beer and a link to the beer. Hubot is now full of
#
different options for beer scripts. Removing the ? (optional) after (a|advocate) will force the command
#
to be 'beer advocate me' and thereby allow this script to coexist with other beer scripts peacefully.
#
#
Dependencies:
#
None
#
#
Configuration:
#
None
#
#
Commands:
#
hubot beer advocate me - returns the latest beer discussed on beer advocate with picture
#
#
Author:
#
whyjustin
module
.
exports
=
(
robot
)
->
robot
.
logger
.
warning
"
The beeradvocate script is broken and will not work (github/hubot-scripts#1436).
"
robot
.
respond
/
beer (a
|
advocate)( me)
?
/
i
, (
msg
)
->
msg
.
send
"
I'm sorry but the beer advocate script is broken and will not work.
"
#
msg.http("http://beeradvocate.com/beer/")
#
.get() (err, res, body) ->
#
if (res.statusCode == 200)
#
reg = /<h6><a href="\/beer\/profile\/(.+?)\/(.+?)\/?">(.+?)<\/a><\/h6>/i
#
results = body.match(reg)
#
if (results != null && results.length > 3)
#
msg.send results[3]
#
msg.send 'http://beeradvocate.com/beer/profile/' + results[1] + '/' + results[2]
#
msg.send 'http://beeradvocate.com/im/thumb.php?im=beers/' + results[2] + '.jpg'
Back
|
FazBrowse Home
|
New Git URL