vrobot4/source/server.rb

48 lines
789 B
Ruby

module Vrobot4::Server
class User
end
class Message
attr_reader :msg
def initialize msg
@msg = msg
end
end
class Channel
end
class Server
def initialize
@modules = []
end
def loadMod mod
@modules << mod
end
def onMessage m
Vrobot4.log :DEBUG, "message:", m.to_s
end
def onCommand m, cnam, argv
Vrobot4.log :DEBUG, "command:", m.to_s, cnam.to_s, argv.to_s
@modules.each {|mod| mod.onCommand m, cnam, argv}
end
end
@@server_types = {}
def self.add_server_type t, name
@@server_types[name] = t
Vrobot4.log :INFO, "added server type:", name
end
def self.get_server_type s
@@server_types[s]
end
end
## EOF