fix errors with IRC

master
an 2019-02-23 23:45:25 -05:00
parent dcb826dd7f
commit 6fbb04415c
1 changed files with 12 additions and 3 deletions

View File

@ -28,6 +28,8 @@ class Sv_IRC < Vrobot4::Server::Server
end
on :message do |evt|
return unless evt.channel
m = Vrobot4::Server::Message.new \
msg: evt.message,
user: User.new(evt.user, evt.channel),
@ -41,6 +43,7 @@ class Sv_IRC < Vrobot4::Server::Server
end
@bot.loggers.level = :warn
@id = info["server"].downcase.sum
end
# (see Vrobot4::Server::Server#connect)
@ -54,6 +57,7 @@ class Sv_IRC < Vrobot4::Server::Server
end
protected
# (see Vrobot4::Server::Server#load_permissions)
def load_permissions pinf
@mprm = {chan: {}, role: {}, glob: {}}
@ -70,13 +74,18 @@ class Sv_IRC < Vrobot4::Server::Server
end if pinf
end
# Helper for channel permissions.
class ChannelPerms
def initialize() @cprm = {} end
# Returns true if the channel is enabled, false otherwise.
# @param chan [Sv_IRC::Channel] the channel for this permission
# @return [Boolean] true if the channel is enabled, false otherwise.
def [](chan) @cprm[chan.name] end
# Sets a channel's permission on/off.
# @param name [String] the channel for this permission
# @param set [Boolean] if this permission should be set
# @return [void]
def []=(name, set) @cprm[name] = set end
end
private_constant :ChannelPerms
@ -90,7 +99,7 @@ class Sv_IRC < Vrobot4::Server::Server
def initialize user, chan
@real = user
@name = user.nick
@id = user.nick.downcase.hash
@id = user.nick.downcase.sum
if user.oper? then @roles = "Oohv"
elsif chan.opped? user then @roles = "ohv"
elsif chan.half_opped? user then @roles = "hv"
@ -107,7 +116,7 @@ class Sv_IRC < Vrobot4::Server::Server
def initialize chan
@real = chan
@name = chan.name.downcase
@id = chan.name.downcase.hash
@id = chan.name.downcase.sum
end
end
end