Class: Chat

Inherits:
Object
  • Object
show all
Defined in:
lib/objects/chat.rb

Overview

This object represents a chat.

Direct Known Subclasses

GetChat, PrivateChat

Instance Method Summary collapse

Constructor Details

#initialize(chat) ⇒ Chat

:nodoc:



12
13
14
# File 'lib/objects/chat.rb', line 12

def initialize(chat) # :nodoc:
  @chat = chat
end

Instance Method Details

#channel?Boolean

Returns true if chat type is channel else false is returned.

Returns:

  • (Boolean)


49
50
51
# File 'lib/objects/chat.rb', line 49

def channel?
  type.eql? 'channel'
end

#has_title?Boolean

Returns true if chat has title else false is returned.

Returns:

  • (Boolean)


54
55
56
# File 'lib/objects/chat.rb', line 54

def has_title?
  title.nil?
end

#idObject

Unique identifier for this chat.



17
18
19
# File 'lib/objects/chat.rb', line 17

def id
  @chat.id
end

#private?Boolean

Returns true if chat type is private else false is returned.

Returns:

  • (Boolean)


39
40
41
# File 'lib/objects/chat.rb', line 39

def private?
  type.eql? 'private'
end

#supergroup?Boolean

Returns true if chat type is supergroup else false is returned.

Returns:

  • (Boolean)


44
45
46
# File 'lib/objects/chat.rb', line 44

def supergroup?
  type.eql? 'supergroup'
end

#titleObject

Optional. Title, for supergroups, channels and group chats.



28
29
30
# File 'lib/objects/chat.rb', line 28

def title
  @chat.title
end

#typeObject

Type of chat, can be either private, group, supergroup or channel.



23
24
25
# File 'lib/objects/chat.rb', line 23

def type
  @chat.type
end

#usernameObject

Optional. Username, for private chats, supergroups and channels if available else nil is returned.



34
35
36
# File 'lib/objects/chat.rb', line 34

def username
  @chat.username
end