igni 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/igni/bot.rb +7 -20
- data/lib/igni/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e295bfb54f8f5ca6b885b400b0ba8ca3792245b4
|
|
4
|
+
data.tar.gz: 305c091d97127440325ffb7b95222e592923b1fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b742ff3189336ad9ddd6c2a01ddc632ae02cccc6fa54f3ea6363e4e399cc2f5bd1db8439255975d7b40ea4debc0d6c2fc026f44664f9b3f830abe742b55580b5
|
|
7
|
+
data.tar.gz: dbe4179cc1ad23500f967f48eb19a4acfbc6c75c890146f97023a653c1af04581938890636198d58912d6460eb85659835fb77d16ed8b9a9d66d8567307e48aa
|
data/lib/igni/bot.rb
CHANGED
|
@@ -18,7 +18,6 @@ module Igni
|
|
|
18
18
|
|
|
19
19
|
@token = hash[:token]
|
|
20
20
|
@hook = hash[:domain]
|
|
21
|
-
@handler = proc { || }
|
|
22
21
|
|
|
23
22
|
puts 'Registering webhook'
|
|
24
23
|
if self.register_webhook
|
|
@@ -28,35 +27,23 @@ module Igni
|
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
abort 'Wrong token' if self.getMe['ok'] != true
|
|
30
|
+
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"Hello from Igni on #{@hook}!"
|
|
35
|
-
end
|
|
36
|
-
|
|
32
|
+
def on(&block)
|
|
33
|
+
@app = Sinatra.new do
|
|
37
34
|
post "/webhook/#{ENV['IGNI_TOKEN']}" do
|
|
38
35
|
raw = request.env["rack.input"].read
|
|
39
36
|
|
|
40
37
|
data = JSON.parse(raw)
|
|
41
38
|
data["raw"] = raw
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
puts raw
|
|
41
|
+
|
|
42
|
+
block.call(data)
|
|
44
43
|
end
|
|
45
44
|
end
|
|
46
45
|
|
|
47
|
-
app.run!
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def on(&block)
|
|
51
|
-
@handler = proc { |message| block.call(message) }
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def greet
|
|
55
|
-
puts "hello"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def handler
|
|
59
|
-
@handler
|
|
46
|
+
@app.run!
|
|
60
47
|
end
|
|
61
48
|
|
|
62
49
|
def register_webhook
|
data/lib/igni/version.rb
CHANGED