class ChatMember
Monday
, August
24
2020
EAT
This object contains information about one member of a chat.¶ ↑
Public Instance Methods
Returns true if user is admin
# File lib/objects/chat_member.rb, line 139 def admin? (status.eql? 'creator') or (status.eql? 'administrator') end
Optional.
Restricted only. True, if the user is allowed to add web page previews to their messages.
# File lib/objects/chat_member.rb, line 128 def can_add_web_page_previews? @memb.can_add_web_page_previews end
Optional.
Administrators only. True, if the bot is allowed to edit administrator privileges of that user.
# File lib/objects/chat_member.rb, line 43 def can_be_edited? @memb.can_be_edited end
Optional.
Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings.
# File lib/objects/chat_member.rb, line 81 def can_change_info? @memb.can_change_info end
Optional.
Administrators only. True, if the administrator can delete messages of other users.
# File lib/objects/chat_member.rb, line 61 def can_delete_messages? @memb.can_delete_messages end
Optional.
Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only.
# File lib/objects/chat_member.rb, line 55 def can_edit_messages? @memb.can_edit_messages end
Optional.
Administrators and restricted only. True, if the user is allowed to invite new users to the chat.
# File lib/objects/chat_member.rb, line 87 def can_invite_users? @memb.can_invite_users end
Optional.
Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only.
# File lib/objects/chat_member.rb, line 93 def can_pin_messages? @memb.can_pin_messages end
Optional.
Administrators only. True, if the administrator can post in the channel; channels only.
# File lib/objects/chat_member.rb, line 49 def can_post_messages? @memb.can_post_messages end
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)
# File lib/objects/chat_member.rb, line 75 def can_promote_members? @memb.can_promote_members end
Optional.
Administrators only. True, if the administrator can restrict, ban_chat_member or unban_chat_member s.
# File lib/objects/chat_member.rb, line 67 def can_restrict_members? @memb.can_restrict_members end
Optional
. Restricted only. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes.
# File lib/objects/chat_member.rb, line 111 def can_send_media_messages? @memb.can_send_media_messages end
Optional
. Restricted only. True, if the user is allowed to send text messages, contacts, locations and venues.
# File lib/objects/chat_member.rb, line 105 def can_send_messages? @memb.can_send_messages end
Optional.
Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots.
# File lib/objects/chat_member.rb, line 122 def can_send_other_messages? @memb.can_send_other_messages end
Optional.
Restricted only. True, if the user is allowed to send polls
# File lib/objects/chat_member.rb, line 116 def can_send_polls? @memb.can_send_polls end
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.
# File lib/objects/chat_member.rb, line 29 def custom_title @memb.custom_title end
Returns true if user if left the chat. NB:
That does not mean it checks if user is a part of chat. Kicked != left
# File lib/objects/chat_member.rb, line 134 def left? status.eql? 'left' end
Optional.
Restricted only. True, if the user is a member of the chat at the moment of the reques.
# File lib/objects/chat_member.rb, line 99 def member? @memb.is_member end
The member's status in the chat. Can be creator
, administrator
, member
, restricted
, left
or kicked
.
# File lib/objects/chat_member.rb, line 22 def status @memb.status end
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.
# File lib/objects/chat_member.rb, line 37 def until_date @memb.until_date end
Information about the user. Return User
object.
# File lib/objects/chat_member.rb, line 16 def user User.new(@memb.user) end