Class: Discordrb::Channel
- Inherits:
-
Object
- Object
- Discordrb::Channel
- Defined in:
- lib/discordrb/data.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_private ⇒ Object
readonly
Returns the value of attribute is_private.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ Channel
constructor
A new instance of Channel.
- #send_message(content) ⇒ Object (also: #send, #message)
Constructor Details
#initialize(data, bot) ⇒ Channel
Returns a new instance of Channel.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/discordrb/data.rb', line 37 def initialize(data, bot) @bot = bot @id = data['id'] @type = data['type'] || 'text' @is_private = data['is_private'] if @is_private @recipient = User.new(data['recipient'], bot) @name = @recipient.username else @name = data['name'] @server = bot.server(data['guild_id'].to_i) end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
35 36 37 |
# File 'lib/discordrb/data.rb', line 35 def id @id end |
#is_private ⇒ Object (readonly)
Returns the value of attribute is_private.
35 36 37 |
# File 'lib/discordrb/data.rb', line 35 def is_private @is_private end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
35 36 37 |
# File 'lib/discordrb/data.rb', line 35 def name @name end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
35 36 37 |
# File 'lib/discordrb/data.rb', line 35 def recipient @recipient end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
35 36 37 |
# File 'lib/discordrb/data.rb', line 35 def server @server end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
35 36 37 |
# File 'lib/discordrb/data.rb', line 35 def type @type end |
Instance Method Details
#send_message(content) ⇒ Object Also known as: send, message
53 54 55 |
# File 'lib/discordrb/data.rb', line 53 def (content) @bot.(@id, content) end |