Created
May 20, 2016 20:09
-
-
Save bougyman/7579526080b0070b9fa811f27211da47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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