IRCinch Basic CTCP
Description
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.
| Request | Default reply |
|---|---|
CLIENTINFO |
Lists supported CTCP commands. |
PING |
Echoes the request's arguments. |
SOURCE |
Links to the IRCinch source code. |
TIME |
Reports the bot's local time. |
VERSION |
Reports the IRCinch version. |
Installation
The gem requires Ruby 3.3 or newer and IRCinch 2.4.6 or newer.
RubyGems
Install a published release with gem install. RubyGems installs IRCinch as a dependency.
gem install ircinch-basic_ctcpBundler
Add the plugin to your Gemfile and run bundle install.
gem "ircinch-basic_ctcp", require: falseTo try a local checkout, add path: "../ircinch-basic_ctcp" to the gem entry and adjust the path to match your checkout.
Example
Load ircinch first, then require the plugin and add Cinch::Plugins::BasicCTCP to your bot's plugin list.
require "ircinch"
require "cinch/plugins/basic_ctcp"
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.libera.chat"
c.nick = "ctcp_example_bot"
c.channels = ["#ircinch-bots"]
c.plugins.plugins = [Cinch::Plugins::BasicCTCP]
end
end
bot.startUse your own nick and channel when trying the example. For help configuring your bot, see the IRCinch Getting Started guide.
Configuration
-
:commandstakes an array of lowercase symbols. Omit it to enable all five replies, or set it to[]to disable them all. -
:repliestakes a hash of custom replies for:version,:source, and:clientinfo. Omitted keys use the built-in replies.
Add this inside your bot's configure block to answer only VERSION and TIME with a custom VERSION reply.
c.plugins.options[Cinch::Plugins::BasicCTCP] = {
commands: [:version, :time],
replies: {version: "My bot v1.0"}
}Code of Conduct
Project discussions and contributions follow the Code of Conduct.
Contributing
Bug reports and pull requests are welcome. See the changelog for release history.
Development
From a checkout of the repository, install the development dependencies and run the tests.
bundle install
bundle exec rake testSimpleCov writes the HTML report to coverage/index.html. Run bundle exec standardrb to check code style.
License
The gem is available under the MIT License.