Move subclasses in Sv_Discord back inside the class scope
parent
0111991818
commit
6d5c0239f3
|
@ -1,33 +1,5 @@
|
|||
require 'discordrb'
|
||||
|
||||
class User < Vrobot4::Server::User
|
||||
attr_reader :real
|
||||
|
||||
def initialize user, ops, hop
|
||||
@real = user
|
||||
@name = user.name
|
||||
@roles = "v"
|
||||
if user.is_a? Discordrb::Member
|
||||
if user.owner?
|
||||
@roles += "Ooh"
|
||||
elsif ops and ops.select {|role| user.role? role}.any?
|
||||
@roles += "oh"
|
||||
elsif hop and hop.select {|role| user.role? role}.any?
|
||||
@roles += "h"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Channel < Vrobot4::Server::Channel
|
||||
attr_reader :real
|
||||
|
||||
def initialize chan
|
||||
@real = chan
|
||||
@name = "#" + chan.name
|
||||
end
|
||||
end
|
||||
|
||||
class Sv_Discord < Vrobot4::Server::AudioServer
|
||||
Vrobot4::Server.add_server_type self, "Discord"
|
||||
|
||||
|
@ -99,22 +71,6 @@ class Sv_Discord < Vrobot4::Server::AudioServer
|
|||
"AD"
|
||||
end
|
||||
|
||||
private
|
||||
class ChannelPerms
|
||||
def initialize
|
||||
@cprm = {}
|
||||
end
|
||||
|
||||
def [] chan
|
||||
(@cprm.key? chan.name and @cprm[chan.name]) or
|
||||
(@cprm.key? chan.real.id and @cprm[chan.real.id])
|
||||
end
|
||||
|
||||
def []= chan, set
|
||||
@cprm[chan] = set
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
def load_permissions pinf
|
||||
@mprm = {chan: {}, role: {}, glob: {}}
|
||||
|
@ -130,6 +86,49 @@ class Sv_Discord < Vrobot4::Server::AudioServer
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ChannelPerms
|
||||
def initialize
|
||||
@cprm = {}
|
||||
end
|
||||
|
||||
def [] chan
|
||||
(@cprm.key? chan.name and @cprm[chan.name]) or
|
||||
(@cprm.key? chan.real.id and @cprm[chan.real.id])
|
||||
end
|
||||
|
||||
def []= chan, set
|
||||
@cprm[chan] = set
|
||||
end
|
||||
end
|
||||
|
||||
class User < Vrobot4::Server::User
|
||||
attr_reader :real
|
||||
|
||||
def initialize user, ops, hop
|
||||
@real = user
|
||||
@name = user.name
|
||||
@roles = "v"
|
||||
if user.is_a? Discordrb::Member
|
||||
if user.owner?
|
||||
@roles += "Ooh"
|
||||
elsif ops and ops.select {|role| user.role? role}.any?
|
||||
@roles += "oh"
|
||||
elsif hop and hop.select {|role| user.role? role}.any?
|
||||
@roles += "h"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Channel < Vrobot4::Server::Channel
|
||||
attr_reader :real
|
||||
|
||||
def initialize chan
|
||||
@real = chan
|
||||
@name = "#" + chan.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
## EOF
|
||||
|
|
Loading…
Reference in New Issue