fix irc module

master
an 2019-03-05 02:23:15 -05:00
parent 5f5aede8ab
commit d4199cf103
4 changed files with 13 additions and 11 deletions

View File

@ -51,6 +51,10 @@ module Backend_Discord
@name = ?# + chan.name
@id = chan.id
end
def send_msg text
@real.send text
end
end
# A Discord server.

View File

@ -45,6 +45,10 @@ module Backend_IRC
@name = chan.name.downcase
@id = Vrobot4.hash_str chan.name.downcase
end
def send_msg text
@real.send text
end
end
# An IRC server.
@ -94,13 +98,14 @@ module Backend_IRC
Vrobot4::Robots.add_bot_type self
attr_accessor :serv # @return [Vrobot4::Server::Server] the server
attr_reader :real # @return [Cinch::Bot] the bot instance
# (see Vrobot4::Robots::Bot#initialize)
def initialize info
super
this = self
@bot = Cinch::Bot.new do
@real = Cinch::Bot.new do
configure do |cfg|
cfg.server = info[:server]
cfg.nick = info[:nick] || "vrobot4"
@ -130,13 +135,13 @@ module Backend_IRC
end
end
@bot.loggers.level = :warn
@real.loggers.level = :warn
@serv = Server.new info, self
end
# (see Vrobot4::Robots::Bot#connect)
def connect
@bot.start
@real.start
end
end
end

View File

@ -8,7 +8,7 @@ class Mod_IRC < Vrobot4::Module::Module
end
def c_raw m, argv
m.serv.bot.irc.send argv
m.bot.real.irc.send argv
end
end

View File

@ -6,13 +6,6 @@ module Vrobot4::Robots
def initialize info
@info = info
end
# Connect to all servers.
# @abstract
# @return [void]
def connect
raise NotImplementedError, "Bot#connect not implemented"
end
end
# Adds a bot type to the global list.