ruboty-gekiron 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 174f1141a862fb71d6d18c255e955b83a5f7e498
4
+ data.tar.gz: 287a2358e99ef9ba479b98609cc27e5502cfbb5c
5
+ SHA512:
6
+ metadata.gz: ca1eb4067550f9632a50fb9dcd7ebc5c3b9480abfffe0ca5b00ddedd36c04633a91b2fd6647208424563906fdd99f1d2d1446f83aeb513fead5bfbbf76a1b460
7
+ data.tar.gz: a6a9d9a05b2c0da5192c8fea2c649752c61ae34b8dbc2744dcf6668752d2c9893dfcc9f2c8c5be9b3a83c70cd9a7c2bdc7c51a83fd0cc3190ce0d749821714aa
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ vendor/
2
+ .bundle/
3
+ pkg/
4
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-gekiron.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Takuma Homma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Ruboty::Gekiron
2
+
3
+ Roboty handler to generate conversation topic.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruboty-gekiron'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```
22
+ $ gem install ruboty-gekiron
23
+ ```
24
+
25
+ Then, create topics yaml file `./config/topics.yml` in your bot code repository
26
+
27
+ ```yaml
28
+ # example
29
+ - テンションが上がるもの
30
+ - オシャレな言葉
31
+ - さらりと言えたらかっこいい言葉
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```
37
+ @ruboty topic
38
+ 「ふ」から始まる、テンションが上がるものは?
39
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,32 @@
1
+ require 'yaml'
2
+ require 'nkf'
3
+
4
+ module Ruboty
5
+ module Gekiron
6
+ module Actions
7
+ class Topic < Ruboty::Actions::Base
8
+ def call
9
+ message.reply(gekiron_topic)
10
+ rescue => e
11
+ message.reply(e.message)
12
+ end
13
+
14
+ private
15
+
16
+ def topic
17
+ path = File.expand_path(ENV['TOPICS_YML'] || './config/topics.yml' )
18
+ YAML.load_file(path).sample
19
+ end
20
+
21
+ def first_letter
22
+ # 小文字, 濁音, ['を', 'ん'] を除く
23
+ [*'ア'..'ワ'].map{ |chr| NKF.nkf('-h1w', NKF.nkf('-Xw', chr)) }.sample
24
+ end
25
+
26
+ def gekiron_topic
27
+ "「#{first_letter}」から始まる、#{topic}は?"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module Gekiron
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require 'ruboty/gekiron'
2
+ require 'ruboty/handlers/gekiron'
3
+ require 'ruboty/gekiron/actions/topic'
4
+
5
+ module Ruboty
6
+ module Gekiron
7
+
8
+ end
9
+ end
10
+
@@ -0,0 +1,15 @@
1
+ module Ruboty
2
+ module Handlers
3
+ class Gekiron < Base
4
+ on(
5
+ /topic/,
6
+ name: 'topic',
7
+ description: '激論しそうな話題を返します'
8
+ )
9
+
10
+ def topic(message)
11
+ Ruboty::Gekiron::Actions::Topic.new(message).call
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/gekiron/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-gekiron"
8
+ spec.version = Ruboty::Gekiron::VERSION
9
+ spec.authors = ["Takuma Homma"]
10
+ spec.email = ["sfprhythnn@gmail.com"]
11
+
12
+ spec.summary = "Ruboty handler to generate conversation topic"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_runtime_dependency "ruboty"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-gekiron
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Takuma Homma
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description:
70
+ email:
71
+ - sfprhythnn@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/ruboty/gekiron.rb
82
+ - lib/ruboty/gekiron/actions/topic.rb
83
+ - lib/ruboty/gekiron/version.rb
84
+ - lib/ruboty/handlers/gekiron.rb
85
+ - ruboty-gekiron.gemspec
86
+ homepage:
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.6.11
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Ruboty handler to generate conversation topic
110
+ test_files: []