cinch-basic_ctcp 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 11ee3479410c54422bdb0770eba8397ff438ad48
4
+ data.tar.gz: d3232145d258744d6dccee39987613ba3fe2ff77
5
+ SHA512:
6
+ metadata.gz: e2c0f1fc6693b8295de580b0e0f4a7d94afee7a987cece04913d1c938b4445b216d2943c004b0cdf3bba2d4bf22c1f8bdd5cddb08088ac54b46162d7b5ed990b
7
+ data.tar.gz: ae58856613584fffd0c43a3d4fa6c7a668585658a5d2775b848f1e571cfe5eb687e072d57b616e13b273e905c2e46afe1da7723f05c38f1c392b04a08fcc1736
data/README.md CHANGED
@@ -13,6 +13,7 @@ First install the gem by running:
13
13
  [sudo] gem install cinch-basic_ctcp
14
14
 
15
15
  Then load it in your bot:
16
+
16
17
  require "cinch"
17
18
  require "cinch/plugins/basic_ctcp"
18
19
 
@@ -38,3 +39,15 @@ are listed in this option.
38
39
  # only reply to VERSION and TIME
39
40
  c.plugins.options[Cinch::Plugins::BasicCTCP][:commands] = [:version, :time]
40
41
  end
42
+
43
+ ### :replies
44
+ This option is a hash table of custom responses to VERSION, SOURCE,
45
+ and CLIENTINFO.
46
+
47
+ ### Example configuration
48
+ configure do |c|
49
+ # send custom CTCP VERSION response
50
+ c.plugins.options[Cinch::Plugins::BasicCTCP][:replies] = {
51
+ :version => 'My robot v1.0'
52
+ }
53
+ end
@@ -11,7 +11,7 @@ module Cinch
11
11
  ctcp :source
12
12
  ctcp :clientinfo
13
13
  def ctcp_version(m)
14
- m.ctcp_reply "Cinch v#{Cinch::VERSION}" if reply_to_ctcp?(:version)
14
+ m.ctcp_reply reply(:version) || "Cinch v#{Cinch::VERSION}" if reply_to_ctcp?(:version)
15
15
  end
16
16
 
17
17
  def ctcp_time(m)
@@ -23,17 +23,22 @@ module Cinch
23
23
  end
24
24
 
25
25
  def ctcp_source(m)
26
- m.ctcp_reply "http://github.com/cinchrb/cinch" if reply_to_ctcp?(:source)
26
+ m.ctcp_reply reply(:source) || "http://github.com/cinchrb/cinch" if reply_to_ctcp?(:source)
27
27
  end
28
28
 
29
29
  def ctcp_clientinfo(m)
30
- m.ctcp_reply "ACTION PING VERSION TIME CLIENTINFO SOURCE" if reply_to_ctcp?(:clientinfo)
30
+ m.ctcp_reply reply(:clientinfo) || "ACTION PING VERSION TIME CLIENTINFO SOURCE" if reply_to_ctcp?(:clientinfo)
31
31
  end
32
32
 
33
33
  def reply_to_ctcp?(command)
34
34
  commands = config[:commands]
35
35
  commands.nil? || commands.include?(command)
36
36
  end
37
+
38
+ private
39
+ def reply(command)
40
+ config[:replies][command]
41
+ end
37
42
  end
38
43
  end
39
44
  end
metadata CHANGED
@@ -1,27 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch-basic_ctcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dominik Honnef
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-03-24 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: cinch
16
- requirement: &13121660 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *13121660
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
25
27
  description: Implement the most important CTCP replies for Cinch bots
26
28
  email:
27
29
  - dominikh@fork-bomb.org
@@ -34,27 +36,26 @@ files:
34
36
  - lib/cinch/plugins/basic_ctcp.rb
35
37
  homepage: http://rubydoc.info/github/cinchrb/cinch-basic_ctcp
36
38
  licenses: []
39
+ metadata: {}
37
40
  post_install_message:
38
41
  rdoc_options: []
39
42
  require_paths:
40
43
  - lib
41
44
  required_ruby_version: !ruby/object:Gem::Requirement
42
- none: false
43
45
  requirements:
44
- - - ! '>='
46
+ - - ">="
45
47
  - !ruby/object:Gem::Version
46
48
  version: 1.9.1
47
49
  required_rubygems_version: !ruby/object:Gem::Requirement
48
- none: false
49
50
  requirements:
50
- - - ! '>='
51
+ - - ">="
51
52
  - !ruby/object:Gem::Version
52
53
  version: '0'
53
54
  requirements: []
54
55
  rubyforge_project:
55
- rubygems_version: 1.8.15
56
+ rubygems_version: 2.4.5.1
56
57
  signing_key:
57
- specification_version: 3
58
+ specification_version: 4
58
59
  summary: Implement the most important CTCP replies for Cinch bots
59
60
  test_files: []
60
61
  has_rdoc: