Skip to content

Instantly share code, notes, and snippets.

@bougyman
Created May 20, 2016 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bougyman/7579526080b0070b9fa811f27211da47 to your computer and use it in GitHub Desktop.
Save bougyman/7579526080b0070b9fa811f27211da47 to your computer and use it in GitHub Desktop.
module IrcRobot
R 'db/init'
M 'user'
M 'mask'
M 'channel'
M 'log'
M 'url'
M 'quote'
M 'ticket'
L 'cinch'
def self.useful(h = {})
channels = h[:channels] || IrcRobot.options.channels
b = IrcRobot::Cinch.new((h[:server] || IrcRobot.options.server), channels)
b.bot.loggers << ::Cinch::Logger::FormattedLogger.new(File.open(IrcRobot.options.logfile, 'w'))
b.bot.loggers = b.bot.loggers.last
b
end
def self.login(bot)
bot.User('UserServ').send "login #{IrcRobot.options[:userserv_user]} #{IrcRobot.options[:userserv_password]}"
bot.User('ChanServ').send 'invite #private-channel'
bot.join '#private-channel'
end
if $PROGRAM_NAME == __FILE__
puts $PROGRAM_NAME
require 'pry'
require 'pry-remote'
u = useful
Thread.new do |_t|
loop do
# Bot is u.bot
begin
binding.pry_remote # rubocop:disable Lint/Debugger
rescue => e
warn e
e.backtrace.each do |err|
warn err
end
nil
end
end
end
u.start
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment