Class: ChatMember
- Inherits:
-
Object
- Object
- ChatMember
- Defined in:
- lib/objects/chat_member.rb
Overview
Monday
, August
24
2020
EAT
This object contains information about one member of a chat.
Instance Method Summary collapse
-
#admin? ⇒ Boolean
Returns true if user is admin.
-
#can_add_web_page_previews? ⇒ Boolean
Optional.
Restricted only. -
#can_be_edited? ⇒ Boolean
Optional.
Administrators only. -
#can_change_info? ⇒ Boolean
Optional.
Administrators and restricted only. -
#can_delete_messages? ⇒ Boolean
Optional.
Administrators only. -
#can_edit_messages? ⇒ Boolean
Optional.
Administrators only. -
#can_invite_users? ⇒ Boolean
Optional.
Administrators and restricted only. -
#can_pin_messages? ⇒ Boolean
Optional.
Administrators and restricted only. -
#can_post_messages? ⇒ Boolean
Optional.
Administrators only. -
#can_promote_members? ⇒ Boolean
Optional.
Administrators only. -
#can_restrict_members? ⇒ Boolean
Optional.
Administrators only. -
#can_send_media_messages? ⇒ Boolean
Optional
. -
#can_send_messages? ⇒ Boolean
Optional
. -
#can_send_other_messages? ⇒ Boolean
Optional.
Restricted only. -
#can_send_polls? ⇒ Boolean
Optional.
Restricted only. -
#custom_title ⇒ Object
Optional.
Owner and administrators only. -
#initialize(mem) ⇒ ChatMember
constructor
:nodoc:.
-
#left? ⇒ Boolean
Returns true if user if left the chat.
-
#member? ⇒ Boolean
Optional.
Restricted only. -
#status ⇒ Object
The member’s status in the chat.
-
#until_date ⇒ Object
Optional.
Restricted and kicked only. -
#user ⇒ Object
Information about the user.
Constructor Details
#initialize(mem) ⇒ ChatMember
:nodoc:
10 11 12 |
# File 'lib/objects/chat_member.rb', line 10 def initialize(mem) # :nodoc: @memb = mem end |
Instance Method Details
#admin? ⇒ Boolean
Returns true if user is admin
139 140 141 |
# File 'lib/objects/chat_member.rb', line 139 def admin? (status.eql? 'creator') or (status.eql? 'administrator') end |
#can_add_web_page_previews? ⇒ Boolean
Optional.
Restricted only. True, if the user is allowed to add web page previews to their messages.
128 129 130 |
# File 'lib/objects/chat_member.rb', line 128 def can_add_web_page_previews? @memb.can_add_web_page_previews end |
#can_be_edited? ⇒ Boolean
Optional.
Administrators only. True, if the bot is allowed to edit administrator privileges of that user.
43 44 45 |
# File 'lib/objects/chat_member.rb', line 43 def can_be_edited? @memb.can_be_edited end |
#can_change_info? ⇒ Boolean
Optional.
Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings.
81 82 83 |
# File 'lib/objects/chat_member.rb', line 81 def can_change_info? @memb.can_change_info end |
#can_delete_messages? ⇒ Boolean
Optional.
Administrators only. True, if the administrator can delete messages of other users.
61 62 63 |
# File 'lib/objects/chat_member.rb', line 61 def @memb. end |
#can_edit_messages? ⇒ Boolean
Optional.
Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only.
55 56 57 |
# File 'lib/objects/chat_member.rb', line 55 def @memb. end |
#can_invite_users? ⇒ Boolean
Optional.
Administrators and restricted only. True, if the user is allowed to invite new users to the chat.
87 88 89 |
# File 'lib/objects/chat_member.rb', line 87 def can_invite_users? @memb.can_invite_users end |
#can_pin_messages? ⇒ Boolean
Optional.
Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only.
93 94 95 |
# File 'lib/objects/chat_member.rb', line 93 def @memb. end |
#can_post_messages? ⇒ Boolean
Optional.
Administrators only. True, if the administrator can post in the channel; channels only.
49 50 51 |
# File 'lib/objects/chat_member.rb', line 49 def @memb. end |
#can_promote_members? ⇒ Boolean
Optional.
Administrators only. True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
75 76 77 |
# File 'lib/objects/chat_member.rb', line 75 def can_promote_members? @memb.can_promote_members end |
#can_restrict_members? ⇒ Boolean
Optional.
Administrators only. True, if the administrator can restrict, #ban_chat_member or #unban_chat_member s.
67 68 69 |
# File 'lib/objects/chat_member.rb', line 67 def can_restrict_members? @memb.can_restrict_members end |
#can_send_media_messages? ⇒ Boolean
Optional
. Restricted only. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes.
111 112 113 |
# File 'lib/objects/chat_member.rb', line 111 def @memb. end |
#can_send_messages? ⇒ Boolean
Optional
. Restricted only. True, if the user is allowed to send text messages, contacts, locations and venues.
105 106 107 |
# File 'lib/objects/chat_member.rb', line 105 def @memb. end |
#can_send_other_messages? ⇒ Boolean
Optional.
Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots.
122 123 124 |
# File 'lib/objects/chat_member.rb', line 122 def @memb. end |
#can_send_polls? ⇒ Boolean
Optional.
Restricted only. True, if the user is allowed to send polls
116 117 118 |
# File 'lib/objects/chat_member.rb', line 116 def can_send_polls? @memb.can_send_polls end |
#custom_title ⇒ Object
Optional.
Owner and administrators only. Custom title for this user. check if user is admin using #admin? before going to use this method, unless nil is returned.
29 30 31 |
# File 'lib/objects/chat_member.rb', line 29 def custom_title @memb.custom_title end |
#left? ⇒ Boolean
Returns true if user if left the chat. NB:
That does not mean it checks if user is a part of chat. Kicked != left
134 135 136 |
# File 'lib/objects/chat_member.rb', line 134 def left? status.eql? 'left' end |
#member? ⇒ Boolean
Optional.
Restricted only. True, if the user is a member of the chat at the moment of the reques.
99 100 101 |
# File 'lib/objects/chat_member.rb', line 99 def member? @memb.is_member end |
#status ⇒ Object
The member’s status in the chat. Can be creator
, administrator
, member
, restricted
, left
or kicked
.
22 23 24 |
# File 'lib/objects/chat_member.rb', line 22 def status @memb.status end |
#until_date ⇒ Object
Optional.
Restricted and kicked only. Date when restrictions will be lifted for this user; unix time. Check if user is restricted or kicked using #member? before going to use this method else if user is not kicked or restricted then nil is returned.
37 38 39 |
# File 'lib/objects/chat_member.rb', line 37 def until_date @memb.until_date end |