Class: GrubY::Chat
Instance Attribute Summary
Attributes inherited from BaseObject
#api, #client
Instance Method Summary
collapse
Methods inherited from BaseObject
#[], #dig, field_names, fields, #initialize, #method_missing, #respond_to_missing?, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class GrubY::BaseObject
Instance Method Details
#add_members(user_ids) ⇒ Object
68
69
70
71
|
# File 'lib/gruubY/types/chat.rb', line 68
def add_members(user_ids)
ids = Array(user_ids)
call_api("addChatMembers", { chat_id: id, user_ids: ids })
end
|
#archive ⇒ Object
8
9
10
|
# File 'lib/gruubY/types/chat.rb', line 8
def archive
call_raw_api("archiveChats", { chat_ids: [id] })
end
|
#ban_member(user_id, **opts) ⇒ Object
32
33
34
|
# File 'lib/gruubY/types/chat.rb', line 32
def ban_member(user_id, **opts)
call_api("banChatMember", { chat_id: id, user_id: user_id }.merge(opts))
end
|
#export_invite_link ⇒ Object
56
57
58
|
# File 'lib/gruubY/types/chat.rb', line 56
def export_invite_link
call_api("exportChatInviteLink", { chat_id: id })
end
|
#get_member(user_id) ⇒ Object
60
61
62
|
# File 'lib/gruubY/types/chat.rb', line 60
def get_member(user_id)
call_api("getChatMember", { chat_id: id, user_id: user_id })
end
|
#get_members(**opts) ⇒ Object
64
65
66
|
# File 'lib/gruubY/types/chat.rb', line 64
def get_members(**opts)
call_raw_api("getChatAdministrators", { chat_id: id }.merge(opts))
end
|
#join ⇒ Object
48
49
50
|
# File 'lib/gruubY/types/chat.rb', line 48
def join
call_api("joinChat", { chat_id: id })
end
|
#leave ⇒ Object
52
53
54
|
# File 'lib/gruubY/types/chat.rb', line 52
def leave
call_api("leaveChat", { chat_id: id })
end
|
#mark_unread ⇒ Object
73
74
75
|
# File 'lib/gruubY/types/chat.rb', line 73
def mark_unread
call_raw_api("markChatUnread", { chat_id: id, is_marked_as_unread: true })
end
|
#mute ⇒ Object
85
86
87
|
# File 'lib/gruubY/types/chat.rb', line 85
def mute
call_raw_api("setChatNotificationSettings", { chat_id: id, mute_for: 2_147_483_647 })
end
|
44
45
46
|
# File 'lib/gruubY/types/chat.rb', line 44
def promote_member(user_id, **opts)
call_api("promoteChatMember", { chat_id: id, user_id: user_id }.merge(opts))
end
|
#restrict_member(user_id, permissions:, **opts) ⇒ Object
40
41
42
|
# File 'lib/gruubY/types/chat.rb', line 40
def restrict_member(user_id, permissions:, **opts)
call_api("restrictChatMember", { chat_id: id, user_id: user_id, permissions: permissions }.merge(opts))
end
|
#set_description(description) ⇒ Object
20
21
22
|
# File 'lib/gruubY/types/chat.rb', line 20
def set_description(description)
call_api("setChatDescription", { chat_id: id, description: description.to_s })
end
|
#set_photo(photo, **opts) ⇒ Object
24
25
26
|
# File 'lib/gruubY/types/chat.rb', line 24
def set_photo(photo, **opts)
call_api("setChatPhoto", { chat_id: id, photo: photo }.merge(opts))
end
|
#set_protected_content(enabled: true) ⇒ Object
77
78
79
|
# File 'lib/gruubY/types/chat.rb', line 77
def set_protected_content(enabled: true)
call_raw_api("setChatProtectedContent", { chat_id: id, has_protected_content: enabled })
end
|
#set_title(title) ⇒ Object
16
17
18
|
# File 'lib/gruubY/types/chat.rb', line 16
def set_title(title)
call_api("setChatTitle", { chat_id: id, title: title.to_s })
end
|
#set_ttl(message_auto_delete_time) ⇒ Object
28
29
30
|
# File 'lib/gruubY/types/chat.rb', line 28
def set_ttl(message_auto_delete_time)
call_api("setChatMessageAutoDeleteTime", { chat_id: id, message_auto_delete_time: message_auto_delete_time.to_i })
end
|
#unarchive ⇒ Object
12
13
14
|
# File 'lib/gruubY/types/chat.rb', line 12
def unarchive
call_raw_api("unarchiveChats", { chat_ids: [id] })
end
|
#unban_member(user_id, **opts) ⇒ Object
36
37
38
|
# File 'lib/gruubY/types/chat.rb', line 36
def unban_member(user_id, **opts)
call_api("unbanChatMember", { chat_id: id, user_id: user_id }.merge(opts))
end
|
#unmute ⇒ Object
89
90
91
|
# File 'lib/gruubY/types/chat.rb', line 89
def unmute
call_raw_api("setChatNotificationSettings", { chat_id: id, mute_for: 0 })
end
|
#unpin_all_messages ⇒ Object
81
82
83
|
# File 'lib/gruubY/types/chat.rb', line 81
def unpin_all_messages
call_api("unpinAllChatMessages", { chat_id: id })
end
|