ircinch-basic_ctcp 1.1.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 +7 -0
- data/CHANGELOG.md +40 -0
- data/LICENSE.txt +19 -0
- data/README.md +94 -0
- data/lib/cinch/plugins/basic_ctcp.rb +52 -0
- metadata +163 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4490cdc9071de7c85a9632ef1ae7b1e142448ab078d762f8deac2aebda555c76
|
|
4
|
+
data.tar.gz: 8712e97457f92bb4aeeb7054a997d2ce6d49be56fe511ad1f382292d159ea65f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2ceececb53b9fb84c5561ab04956c22f4e13db8c47a62d64843d7d574964fd12b4cf1d931d7f032ba6d8ac333161615a363b5bf52f9f8cc3c1a796a6ef7f94cd
|
|
7
|
+
data.tar.gz: 112bdb1c38da98e086a4fc671c931406a24bca5130f07109c6f657b5220d6ede40dbac40ee12fb88d701d6bc5b6356cd1061d3439e457701338d3910816f8b1a
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## ircinch-basic_ctcp 1.1.2 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
- Forked `cinch-basic_ctcp` as `ircinch-basic_ctcp`. The gem requires IRCinch 2.4.6 or later and Ruby 3.3 or later. Load it with `require "cinch/plugins/basic_ctcp"` and register `Cinch::Plugins::BasicCTCP`.
|
|
6
|
+
- Updated the default `VERSION` reply to report IRCinch and the default `SOURCE` reply to link to the IRCinch repository.
|
|
7
|
+
- Fixed `VERSION`, `SOURCE`, and `CLIENTINFO` replies when `:replies` is omitted. Partial overrides fall back to the built-in replies for the other commands.
|
|
8
|
+
- Reused the built-in `VERSION`, `SOURCE`, and `CLIENTINFO` reply strings, eliminated the empty hash allocation when `:replies` is omitted, and removed the unused `time` require.
|
|
9
|
+
- Added tests covering all five CTCP replies, custom replies, and command filtering.
|
|
10
|
+
- Updated the installation documentation and gem metadata.
|
|
11
|
+
|
|
12
|
+
## Original cinch-basic_ctcp releases
|
|
13
|
+
|
|
14
|
+
Historical entries are based on the published gems and the original repository's commit history. [RubyGems release archive](https://rubygems.org/gems/cinch-basic_ctcp/versions) · [Original repository](https://github.com/cinchrb/cinch-basic_ctcp)
|
|
15
|
+
|
|
16
|
+
### 1.1.1 (2016-02-22)
|
|
17
|
+
|
|
18
|
+
- Reissued 1.1.0 with the same packaged files and dependency requirements.
|
|
19
|
+
|
|
20
|
+
### 1.1.0 (2016-02-22)
|
|
21
|
+
|
|
22
|
+
- Added the `:replies` option for overriding `VERSION`, `SOURCE`, and `CLIENTINFO` replies.
|
|
23
|
+
- Fixed Markdown formatting so the installation example displays the `require` lines as code.
|
|
24
|
+
|
|
25
|
+
### 1.0.2 (2012-03-24)
|
|
26
|
+
|
|
27
|
+
- Updated the runtime dependency to the stable Cinch 2.x series (`~> 2.0`).
|
|
28
|
+
|
|
29
|
+
### 1.0.1 (2012-03-06)
|
|
30
|
+
|
|
31
|
+
- Relaxed the Cinch dependency to `>= 2.0.0.pre.1` so newer releases could be used.
|
|
32
|
+
|
|
33
|
+
### 1.0.0 (2012-03-04)
|
|
34
|
+
|
|
35
|
+
- Switched the runtime dependency from Cinch 1.x to `2.0.0.pre.1`.
|
|
36
|
+
|
|
37
|
+
### 0.0.1 (2011-01-30)
|
|
38
|
+
|
|
39
|
+
- Released the plugin for Cinch 1.x with replies for `CLIENTINFO`, `PING`, `SOURCE`, `TIME`, and `VERSION`.
|
|
40
|
+
- Added the `:commands` option to restrict which CTCP requests the plugin answers.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (C) 2011 by Dominik Honnef
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# IRCinch Basic CTCP
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
`ircinch-basic_ctcp` lets your IRCinch bot answer common Client-to-Client Protocol (CTCP) requests. Add the plugin to your bot to enable all five replies, or configure which requests it answers.
|
|
6
|
+
|
|
7
|
+
| Request | Default reply |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `CLIENTINFO` | Lists supported CTCP commands. |
|
|
10
|
+
| `PING` | Echoes the request's arguments. |
|
|
11
|
+
| `SOURCE` | Links to the IRCinch source code. |
|
|
12
|
+
| `TIME` | Reports the bot's local time. |
|
|
13
|
+
| `VERSION` | Reports the IRCinch version. |
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
The gem requires Ruby 3.3 or newer and IRCinch 2.4.6 or newer.
|
|
18
|
+
|
|
19
|
+
### RubyGems
|
|
20
|
+
|
|
21
|
+
Install a published release with `gem install`. RubyGems installs IRCinch as a dependency.
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
gem install ircinch-basic_ctcp
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Bundler
|
|
28
|
+
|
|
29
|
+
Add the plugin to your `Gemfile` and run `bundle install`.
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
gem "ircinch-basic_ctcp", require: false
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To try a local checkout, add `path: "../ircinch-basic_ctcp"` to the gem entry and adjust the path to match your checkout.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
Load `ircinch` first, then require the plugin and add `Cinch::Plugins::BasicCTCP` to your bot's plugin list.
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
require "ircinch"
|
|
43
|
+
require "cinch/plugins/basic_ctcp"
|
|
44
|
+
|
|
45
|
+
bot = Cinch::Bot.new do
|
|
46
|
+
configure do |c|
|
|
47
|
+
c.server = "irc.libera.chat"
|
|
48
|
+
c.nick = "ctcp_example_bot"
|
|
49
|
+
c.channels = ["#ircinch-bots"]
|
|
50
|
+
c.plugins.plugins = [Cinch::Plugins::BasicCTCP]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
bot.start
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use your own nick and channel when trying the example. For help configuring your bot, see the [IRCinch Getting Started guide](https://github.com/ircinchrb/ircinch/blob/main/docs/getting_started.md).
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
- `:commands` takes an array of lowercase symbols. Omit it to enable all five replies, or set it to `[]` to disable them all.
|
|
62
|
+
- `:replies` takes a hash of custom replies for `:version`, `:source`, and `:clientinfo`. Omitted keys use the built-in replies.
|
|
63
|
+
|
|
64
|
+
Add this inside your bot's `configure` block to answer only `VERSION` and `TIME` with a custom `VERSION` reply.
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
c.plugins.options[Cinch::Plugins::BasicCTCP] = {
|
|
68
|
+
commands: [:version, :time],
|
|
69
|
+
replies: {version: "My bot v1.0"}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Code of Conduct
|
|
74
|
+
|
|
75
|
+
Project discussions and contributions follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
76
|
+
|
|
77
|
+
## Contributing
|
|
78
|
+
|
|
79
|
+
Bug reports and pull requests are welcome. See the [changelog](CHANGELOG.md) for release history.
|
|
80
|
+
|
|
81
|
+
### Development
|
|
82
|
+
|
|
83
|
+
From a checkout of the repository, install the development dependencies and run the tests.
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
bundle install
|
|
87
|
+
bundle exec rake test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
SimpleCov writes the HTML report to `coverage/index.html`. Run `bundle exec standardrb` to check code style.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
The gem is available under the [MIT License](LICENSE.txt).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cinch
|
|
4
|
+
module Plugins
|
|
5
|
+
class BasicCTCP
|
|
6
|
+
include Cinch::Plugin
|
|
7
|
+
|
|
8
|
+
DEFAULT_VERSION_REPLY = "IRCinch v#{Cinch::VERSION}".freeze
|
|
9
|
+
private_constant :DEFAULT_VERSION_REPLY
|
|
10
|
+
|
|
11
|
+
ctcp :version
|
|
12
|
+
ctcp :time
|
|
13
|
+
ctcp :ping
|
|
14
|
+
ctcp :source
|
|
15
|
+
ctcp :clientinfo
|
|
16
|
+
|
|
17
|
+
def ctcp_version(m)
|
|
18
|
+
m.ctcp_reply reply(:version) || DEFAULT_VERSION_REPLY if reply_to_ctcp?(:version)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def ctcp_time(m)
|
|
22
|
+
m.ctcp_reply Time.now.strftime("%a %b %d %H:%M:%S %Z %Y") if reply_to_ctcp?(:time)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def ctcp_ping(m)
|
|
26
|
+
return unless reply_to_ctcp?(:ping) && m.command == "PRIVMSG"
|
|
27
|
+
|
|
28
|
+
m.user.notice "\001#{m.ctcp_message}\001"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def ctcp_source(m)
|
|
32
|
+
m.ctcp_reply reply(:source) || "https://github.com/ircinchrb/ircinch" if reply_to_ctcp?(:source)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ctcp_clientinfo(m)
|
|
36
|
+
m.ctcp_reply reply(:clientinfo) || "ACTION PING VERSION TIME CLIENTINFO SOURCE" if reply_to_ctcp?(:clientinfo)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def reply_to_ctcp?(command)
|
|
40
|
+
commands = config[:commands]
|
|
41
|
+
commands.nil? || commands.include?(command)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def reply(command)
|
|
47
|
+
replies = config[:replies]
|
|
48
|
+
replies[command] if replies
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ircinch-basic_ctcp
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.1.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Matt Sias
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ircinch
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.4.6
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- ">="
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: 2.4.6
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: bundler-audit
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
-
|
|
33
|
+
- ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: "0"
|
|
36
|
+
type: :development
|
|
37
|
+
prerelease: false
|
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
-
|
|
41
|
+
- ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "0"
|
|
44
|
+
- !ruby/object:Gem::Dependency
|
|
45
|
+
name: bundler-integrity
|
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
-
|
|
49
|
+
- ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: "0"
|
|
52
|
+
type: :development
|
|
53
|
+
prerelease: false
|
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
-
|
|
57
|
+
- ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: "0"
|
|
60
|
+
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: minitest
|
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
-
|
|
65
|
+
- ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: "0"
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
-
|
|
73
|
+
- ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: "0"
|
|
76
|
+
- !ruby/object:Gem::Dependency
|
|
77
|
+
name: rake
|
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
-
|
|
81
|
+
- ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: "0"
|
|
84
|
+
type: :development
|
|
85
|
+
prerelease: false
|
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
-
|
|
89
|
+
- ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: "0"
|
|
92
|
+
- !ruby/object:Gem::Dependency
|
|
93
|
+
name: simplecov
|
|
94
|
+
requirement: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
-
|
|
97
|
+
- ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: "0"
|
|
100
|
+
type: :development
|
|
101
|
+
prerelease: false
|
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
-
|
|
105
|
+
- ">="
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: "0"
|
|
108
|
+
- !ruby/object:Gem::Dependency
|
|
109
|
+
name: standard
|
|
110
|
+
requirement: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
-
|
|
113
|
+
- ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: "0"
|
|
116
|
+
type: :development
|
|
117
|
+
prerelease: false
|
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
-
|
|
121
|
+
- ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: "0"
|
|
124
|
+
description: "Reply to CLIENTINFO, PING, SOURCE, TIME, and VERSION requests in IRCinch bots"
|
|
125
|
+
email:
|
|
126
|
+
- mattsias@gmail.com
|
|
127
|
+
executables: []
|
|
128
|
+
extensions: []
|
|
129
|
+
extra_rdoc_files: []
|
|
130
|
+
files:
|
|
131
|
+
- CHANGELOG.md
|
|
132
|
+
- LICENSE.txt
|
|
133
|
+
- README.md
|
|
134
|
+
- lib/cinch/plugins/basic_ctcp.rb
|
|
135
|
+
homepage: "https://github.com/ircinchrb/ircinch-basic_ctcp"
|
|
136
|
+
licenses:
|
|
137
|
+
- MIT
|
|
138
|
+
metadata:
|
|
139
|
+
bug_tracker_uri: "https://github.com/ircinchrb/ircinch-basic_ctcp/issues"
|
|
140
|
+
changelog_uri: "https://github.com/ircinchrb/ircinch-basic_ctcp/blob/main/CHANGELOG.md"
|
|
141
|
+
documentation_uri: "https://rubydoc.info/gems/ircinch-basic_ctcp"
|
|
142
|
+
source_code_uri: "https://github.com/ircinchrb/ircinch-basic_ctcp"
|
|
143
|
+
rubygems_mfa_required: "true"
|
|
144
|
+
rdoc_options: []
|
|
145
|
+
require_paths:
|
|
146
|
+
- lib
|
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
-
|
|
150
|
+
- ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: 3.3.0
|
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
|
+
requirements:
|
|
155
|
+
-
|
|
156
|
+
- ">="
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: "0"
|
|
159
|
+
requirements: []
|
|
160
|
+
rubygems_version: 4.1.0
|
|
161
|
+
specification_version: 4
|
|
162
|
+
summary: Implement the most important CTCP replies for IRCinch bots
|
|
163
|
+
test_files: []
|