Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
executable file 40 lines (33 sloc) 1020 Bytes
#!/usr/bin/env ruby
# frozen_string_literal: true
# cloud2butt-irc.rb
# Author: William Woodruff
# ------------------------
# An IRC version of the Cloud2Butt browser plugin.
# Matches any message containing "cloud" (case-insensitive), substituting
# each "cloud" for "butt".
# Usage: ruby cloud2butt-irc.rb <server> <"#chan1,#chan2,...">
# ------------------------
# This code is licensed by William Woodruff under the MIT License.
# http://opensource.org/licenses/MIT
require "cinch"
BOTNAME = "cloud2butt"
TRIGGER = "cloud"
bot = Cinch::Bot.new do
configure do |c|
c.port = 6697
c.ssl.use = true
c.nick = BOTNAME
c.realname = BOTNAME
c.max_messages = 1
c.server = ARGV[0]
c.channels = ARGV[1].split(",")
end
on :message, /#{TRIGGER}/i do |m|
m.reply m.message.gsub(/#{TRIGGER}/i, "butt") if Random.rand(1..5) == 1
end
on :message, /^[.!:]source$/ do |m|
m.reply "https://github.com/woodruffw/snippets/blob/master/cloud2butt-irc/cloud2butt-irc"
end
end
bot.start
You can’t perform that action at this time.