This repository was archived by the owner on Jun 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathtrollicon.coffee
67 lines (60 loc) · 2.45 KB
/
trollicon.coffee
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Description:
# Return trollicon images
# used resources from : https://github.com/sagargp/trollicons Adium extension
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# :<trollicon>: - outputs <trollicon> image
# :isee: what you did there, and :megusta: - is a valid example of multiple trollicons
#
# Author:
# Adan Alvarado and Enrique Vidal
trollicons = {
'gasp' : 'http://i.imgur.com/tYmuZ.png',
'challenge' : 'http://i.imgur.com/jbKmr.png',
'lol' : 'http://i.imgur.com/WjI3L.png',
'no' : 'http://i.imgur.com/loC5s.png',
'yao' : 'http://i.imgur.com/wTAP3.png',
'kidding' : 'http://i.imgur.com/0uCcv.png',
'megusta' : 'http://i.imgur.com/QfeUB.png',
'isee' : 'http://i.imgur.com/M4bcv.png',
'fuckyeah' : 'http://i.imgur.com/m7mEZ.png',
'problem' : 'http://i.imgur.com/oLlJm.png',
'dissapoint' : 'http://i.imgur.com/EwBi7.png',
'nothing' : 'http://i.imgur.com/Nwos9.png',
'pokerface' : 'http://i.imgur.com/dDjvG.png',
'ok' : 'http://i.imgur.com/QRCoI.png',
'sadtroll' : 'http://i.imgur.com/gYsxd.png',
'yuno' : 'http://i.imgur.com/sZMnV.png',
'true' : 'http://i.imgur.com/oealL.png',
'freddie' : 'http://i.imgur.com/zszUl.png',
'forever' : 'http://i.imgur.com/5MBi2.png',
'jackie' : 'http://i.imgur.com/63oaA.png',
'fu' : 'http://i.imgur.com/YHYTg.png',
'rage' : 'http://i.imgur.com/itXDM.png',
'areyoukiddingme' : 'http://i.imgur.com/0uCcv.png',
'nothingtodo' : 'http://i.imgur.com/Nwos9.png',
'moonshot' : 'http://i.imgur.com/E8Dq3.png',
'cerealguy' : 'http://i.imgur.com/sD2jS.png',
'gtfo' : 'http://i.imgur.com/kSxyw.png',
'youdontsay' : 'http://i.imgur.com/xq9Ix.png',
'motherofgod' : 'http://i.imgur.com/CxL3b.png',
'likeasir' : 'http://i.imgur.com/CqBdw.png'
}
module.exports = (robot)->
robot.hear /:(\w+):/g, (message)->
build_response message
build_response = (message)->
orig_response = message.message.text
response = orig_response
return if message.match.length == 0
for icon in message.match
expr = new RegExp( icon, 'g' )
image = trollicons[ icon.replace( /:/g, '' ) ]
response = response.replace( expr, image ) if image != undefined
message.send response if response != undefined and response != orig_response