lita-pebbles 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/lita-pebbles.rb +1 -0
- data/lib/lita/handlers/schedules.rb +59 -0
- data/lib/lita/pebbles/version.rb +1 -1
- data/lita-pebbles.gemspec +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd31993f54ef9558b9b083a9c63fa2565dac7b9b
|
4
|
+
data.tar.gz: fd039eff9ce3533399c4e7f1c193da9492cedcc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 169d88c26ee1b32b1f1736cd38c5c82d65c5a8d7f3b81e4f364c7b9baf4a000fda9f9525a9e5fd50bbec4dd9605dec5e470f653766e4391afb487c2cbc669c6d
|
7
|
+
data.tar.gz: 0177fc7bf9163d0b4e8c113db5c6a20398d414b2800ee967b21c049516a6301a94b81b40efac3b3b7c65f509a896d309de900b9cee27cccc94815b14a3e49c58
|
data/README.md
CHANGED
@@ -14,6 +14,16 @@ And then execute:
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
+
```
|
18
|
+
# lita_config.rb (example)
|
19
|
+
Lita.configure do |config|
|
20
|
+
config.handlers.schedules.room = ENV["BOT_ROOM_ID"]
|
21
|
+
config.handlers.schedules.should_sleep_at = '* * * * * Asia/Tokyo'
|
22
|
+
config.handlers.schedules.should_wake_up_at = '* * * * * Asia/Tokyo'
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
|
17
27
|
```
|
18
28
|
Lita: sudden 突然の死
|
19
29
|
Lita: flip foobar
|
data/lib/lita-pebbles.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rufus-scheduler'
|
2
|
+
|
3
|
+
module Lita
|
4
|
+
module Handlers
|
5
|
+
class Schedules < Handler
|
6
|
+
def self.default_config(handler_config)
|
7
|
+
handler_config.room = nil
|
8
|
+
handler_config.should_sleep_at = nil
|
9
|
+
handler_config.should_wake_up_at = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
on :loaded, :init_scheduler
|
13
|
+
def init_scheduler(payload)
|
14
|
+
return unless config.room
|
15
|
+
|
16
|
+
@scheduler = Rufus::Scheduler.new
|
17
|
+
|
18
|
+
if should_sleep_at = config.should_sleep_at
|
19
|
+
@scheduler.cron should_sleep_at do
|
20
|
+
robot.trigger(:should_sleep, room: config.room)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
if should_wake_up_at = config.should_wake_up_at
|
25
|
+
@scheduler.cron should_wake_up_at do
|
26
|
+
robot.trigger(:should_wake_up, room: config.room)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
on :should_sleep, :should_sleep
|
32
|
+
def should_sleep(payload)
|
33
|
+
target = Source.new(room: payload[:room])
|
34
|
+
robot.send_message(target, "ねな( ˘ω˘)")
|
35
|
+
end
|
36
|
+
|
37
|
+
on :should_wake_up, :should_wake_up
|
38
|
+
def should_wake_up(payload)
|
39
|
+
target = Source.new(room: payload[:room])
|
40
|
+
messages = [
|
41
|
+
'₍₍ (̨̡ ˘ω˘)̧̢ ₎₎',
|
42
|
+
'( ⁰⊖⁰)',
|
43
|
+
'( ˘ω˘)クソネミ',
|
44
|
+
'(◉ω◉)',
|
45
|
+
'₍₍ (̨̡ ‾᷄⌂‾᷅)̧̢ ₎₎',
|
46
|
+
'起きた |ωΦ)',
|
47
|
+
'٩( ˘ω˘ )و',
|
48
|
+
]
|
49
|
+
robot.send_message(target, messages.sample)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def config
|
54
|
+
Lita.config.handlers.schedules
|
55
|
+
end
|
56
|
+
end
|
57
|
+
Lita.register_handler(Schedules)
|
58
|
+
end
|
59
|
+
end
|
data/lib/lita/pebbles/version.rb
CHANGED
data/lita-pebbles.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency "lita", ">= 2.0"
|
24
24
|
spec.add_runtime_dependency 'pebbles-suddenly_death_string', '~> 0.0.4'
|
25
25
|
spec.add_runtime_dependency 'flippy', '~> 0.1.2'
|
26
|
+
spec.add_runtime_dependency 'rufus-scheduler', '~> 3.0.7'
|
26
27
|
|
27
28
|
spec.add_development_dependency "bundler", "~> 1.5"
|
28
29
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-pebbles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukayatsu
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.1.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rufus-scheduler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.7
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.7
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +126,7 @@ files:
|
|
112
126
|
- lib/lita/handlers/misawa.rb
|
113
127
|
- lib/lita/handlers/omikuji.rb
|
114
128
|
- lib/lita/handlers/pebbles.rb
|
129
|
+
- lib/lita/handlers/schedules.rb
|
115
130
|
- lib/lita/pebbles/version.rb
|
116
131
|
- lita-pebbles.gemspec
|
117
132
|
homepage: https://github.com/fukayatsu/lita-pebbles
|