ruboty-echo_to 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2791415212bf989408f97504e21eaf5efc5a0896
4
- data.tar.gz: ffebe87d2dca6ad80b5f85cf7733372dd1d07985
3
+ metadata.gz: d1e746b9e89d00f6fe2b856ddcba3a9590e7d547
4
+ data.tar.gz: 22e7dbde33a39490a773a4f6aa3cf7e8e70cd4c3
5
5
  SHA512:
6
- metadata.gz: 71d1c62fbc22ad0b7bbe09ed88a2ad05e9c000bbc825fd5dcf5ee88678ab7133f20da7ab6a9110952efe3a6b23c538f0f0c9f6a5fc0f5dc94207f0e4c4d2f61b
7
- data.tar.gz: 5881628e3bb5ec5eee194f1b17e8d0eb16e096905f301ac984ab89405a03836f333747ea25d1508ac60b34188581796e69f1c17cd102be020b13c8366fe2715d
6
+ metadata.gz: c800a415359b0d492af4075b1606e062d04b1662e41f07b8c19fce8ddb4895093cf69dd5914166b401a87c12844209092ad75de1ecdf256222f6f22f6fa0d032
7
+ data.tar.gz: 9fd03b32efbab438f1acbe1847f84c47e597a6e5136f087ff1cd66b7ad752394a0fd9e65c2cca6d4b10479dc8f2e01bb5aabe28046d44fa3a635765da6b035c4
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-echo_to.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 hkdnet
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,36 @@
1
+ # Ruboty::EchoTo
2
+
3
+ A plugin for Ruboty which allows your bot to echo to another channel.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruboty-echo_to'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ruboty-echo_to
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ @ruboty echo_to #channel message
25
+ ```
26
+
27
+ @ruboty will send message to the specified channel.
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hkdnet/ruboty-echo_to. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
32
+
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :upgrade do
4
+ `git add .`
5
+ `git commit -m "auto upgrade"`
6
+ `git push origin master`
7
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module EchoTo
3
+ VERSION = '1.0.1'
4
+ end
5
+ end
@@ -0,0 +1,49 @@
1
+ require 'ruboty'
2
+ require 'ruboty/echo_to/version'
3
+
4
+ module Ruboty
5
+ module Handlers
6
+ class EchoTo < Base
7
+ on(
8
+ /echo_to\s+#(.+?)\s+(.*)/m,
9
+ name: 'echo_to',
10
+ description: 'send your message to another channel'
11
+ )
12
+
13
+ def echo_to(message)
14
+ class << message
15
+ def reply_to!(channel, text)
16
+ @original[:from] = new_to(channel)
17
+ @original[:type] = 'groupchat'
18
+ reply(text)
19
+ end
20
+
21
+ def new_to(channel)
22
+ "#{channel}@conference.#{ENV['SLACK_TEAM']}.xmpp.slack.com/#{ENV['SLACK_USERNAME']}"
23
+ end
24
+ end
25
+ message.reply_to!(message.match_data[1],
26
+ message.match_data[2])
27
+ end
28
+
29
+ # for debug
30
+ def et_debug(message)
31
+ class << message
32
+ def debug
33
+ text = "original------\n" \
34
+ "from: #{@original[:from]}\n" \
35
+ "to: #{@original[:to]}\n" \
36
+ "type: #{@original[:type]}\n" \
37
+ "#{new_to('channel')}"
38
+ reply(text)
39
+ end
40
+
41
+ def new_to(channel)
42
+ "#{channel}@conference.#{ENV['SLACK_TEAM']}.xmpp.slack.com/#{ENV['SLACK_USERNAME']}"
43
+ end
44
+ end
45
+ message.debug
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/echo_to/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'ruboty-echo_to'
8
+ spec.version = Ruboty::EchoTo::VERSION
9
+ spec.authors = ['hkdnet']
10
+ spec.email = ['hkdnet@users.noreply.github.com']
11
+
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ spec.summary = 'echo given message to another channel.'
14
+ spec.homepage = 'https://github.com/hkdnet/ruboty-echo_to'
15
+ spec.license = 'MIT'
16
+
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'ruboty'
20
+ spec.add_development_dependency 'bundler', '~> 1.10'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-echo_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hkdnet
@@ -58,7 +58,15 @@ email:
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
- files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/ruboty/echo_to.rb
68
+ - lib/ruboty/echo_to/version.rb
69
+ - ruboty-echo_to.gemspec
62
70
  homepage: https://github.com/hkdnet/ruboty-echo_to
63
71
  licenses:
64
72
  - MIT