fix irc module
parent
5f5aede8ab
commit
d4199cf103
|
@ -51,6 +51,10 @@ module Backend_Discord
|
||||||
@name = ?# + chan.name
|
@name = ?# + chan.name
|
||||||
@id = chan.id
|
@id = chan.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_msg text
|
||||||
|
@real.send text
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# A Discord server.
|
# A Discord server.
|
||||||
|
|
|
@ -45,6 +45,10 @@ module Backend_IRC
|
||||||
@name = chan.name.downcase
|
@name = chan.name.downcase
|
||||||
@id = Vrobot4.hash_str chan.name.downcase
|
@id = Vrobot4.hash_str chan.name.downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_msg text
|
||||||
|
@real.send text
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# An IRC server.
|
# An IRC server.
|
||||||
|
@ -94,13 +98,14 @@ module Backend_IRC
|
||||||
Vrobot4::Robots.add_bot_type self
|
Vrobot4::Robots.add_bot_type self
|
||||||
|
|
||||||
attr_accessor :serv # @return [Vrobot4::Server::Server] the server
|
attr_accessor :serv # @return [Vrobot4::Server::Server] the server
|
||||||
|
attr_reader :real # @return [Cinch::Bot] the bot instance
|
||||||
|
|
||||||
# (see Vrobot4::Robots::Bot#initialize)
|
# (see Vrobot4::Robots::Bot#initialize)
|
||||||
def initialize info
|
def initialize info
|
||||||
super
|
super
|
||||||
this = self
|
this = self
|
||||||
|
|
||||||
@bot = Cinch::Bot.new do
|
@real = Cinch::Bot.new do
|
||||||
configure do |cfg|
|
configure do |cfg|
|
||||||
cfg.server = info[:server]
|
cfg.server = info[:server]
|
||||||
cfg.nick = info[:nick] || "vrobot4"
|
cfg.nick = info[:nick] || "vrobot4"
|
||||||
|
@ -130,13 +135,13 @@ module Backend_IRC
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@bot.loggers.level = :warn
|
@real.loggers.level = :warn
|
||||||
@serv = Server.new info, self
|
@serv = Server.new info, self
|
||||||
end
|
end
|
||||||
|
|
||||||
# (see Vrobot4::Robots::Bot#connect)
|
# (see Vrobot4::Robots::Bot#connect)
|
||||||
def connect
|
def connect
|
||||||
@bot.start
|
@real.start
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Mod_IRC < Vrobot4::Module::Module
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_raw m, argv
|
def c_raw m, argv
|
||||||
m.serv.bot.irc.send argv
|
m.bot.real.irc.send argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,6 @@ module Vrobot4::Robots
|
||||||
def initialize info
|
def initialize info
|
||||||
@info = info
|
@info = info
|
||||||
end
|
end
|
||||||
|
|
||||||
# Connect to all servers.
|
|
||||||
# @abstract
|
|
||||||
# @return [void]
|
|
||||||
def connect
|
|
||||||
raise NotImplementedError, "Bot#connect not implemented"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds a bot type to the global list.
|
# Adds a bot type to the global list.
|
||||||
|
|
Loading…
Reference in New Issue