Class: Discordrb::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data.rb

Overview

A Discord role that contains permissions and applies to certain users

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot, server = nil) ⇒ Role

Returns a new instance of Role.



125
126
127
128
129
130
131
132
133
# File 'lib/discordrb/data.rb', line 125

def initialize(data, bot, server = nil)
  @bot = bot
  @server = server
  @permissions = Permissions.new(data['permissions'])
  @name = data['name']
  @id = data['id'].to_i
  @hoist = data['hoist']
  @color = ColorRGB.new(data['color'])
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



123
124
125
# File 'lib/discordrb/data.rb', line 123

def color
  @color
end

#hoistObject (readonly)

Returns the value of attribute hoist.



122
123
124
# File 'lib/discordrb/data.rb', line 122

def hoist
  @hoist
end

#idObject (readonly)

Returns the value of attribute id.



121
122
123
# File 'lib/discordrb/data.rb', line 121

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



120
121
122
# File 'lib/discordrb/data.rb', line 120

def name
  @name
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



119
120
121
# File 'lib/discordrb/data.rb', line 119

def permissions
  @permissions
end

Instance Method Details

#update_from(other) ⇒ Object



135
136
137
138
139
140
# File 'lib/discordrb/data.rb', line 135

def update_from(other)
  @permissions = other.permissions
  @name = other.name
  @hoist = other.hoist
  @color = other.color
end