teleruby 1.5.1 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.md +9 -0
- data/README.md +398 -0
- data/lib/api/all.rb +12 -0
- data/lib/api/delete_apis.rb +55 -0
- data/lib/api/get_apis.rb +162 -0
- data/lib/api/nstandard.rb +26 -0
- data/lib/api/other_apis.rb +225 -0
- data/lib/api/send_apis.rb +191 -0
- data/lib/api/set_apis.rb +130 -0
- data/lib/core_api.rb +41 -0
- data/lib/objects/all.rb +42 -0
- data/lib/objects/animation.rb +38 -0
- data/lib/objects/audio.rb +37 -0
- data/lib/objects/bot_command.rb +24 -0
- data/lib/objects/callback_query.rb +64 -0
- data/lib/objects/chat.rb +158 -0
- data/lib/objects/chat_member.rb +142 -0
- data/lib/objects/chat_permissions.rb +59 -0
- data/lib/objects/chat_photo.rb +37 -0
- data/lib/objects/chosen_inline_result.rb +43 -0
- data/lib/objects/contact.rb +37 -0
- data/lib/objects/dice.rb +21 -0
- data/lib/objects/document.rb +27 -0
- data/lib/objects/file.rb +32 -0
- data/lib/objects/game.rb +65 -0
- data/lib/objects/inline_query.rb +42 -0
- data/lib/objects/inlinekeyboardbutton.rb +59 -0
- data/lib/objects/inlinekeyboardmarkup.rb +30 -0
- data/lib/objects/location.rb +21 -0
- data/lib/objects/mask_position.rb +35 -0
- data/lib/objects/message.rb +378 -0
- data/lib/objects/message_entity.rb +93 -0
- data/lib/objects/order_info.rb +34 -0
- data/lib/objects/photo_size.rb +14 -0
- data/lib/objects/poll.rb +97 -0
- data/lib/objects/poll_answer.rb +29 -0
- data/lib/objects/poll_option.rb +22 -0
- data/lib/objects/pre_checkout_query.rb +48 -0
- data/lib/objects/same/common.rb +37 -0
- data/lib/objects/same/common_2.rb +38 -0
- data/lib/objects/shipping_address.rb +39 -0
- data/lib/objects/shipping_query.rb +32 -0
- data/lib/objects/sticker.rb +55 -0
- data/lib/objects/update.rb +174 -0
- data/lib/objects/user.rb +66 -0
- data/lib/objects/user_profile_photos.rb +35 -0
- data/lib/objects/venue.rb +40 -0
- data/lib/objects/video.rb +37 -0
- data/lib/objects/video_note.rb +48 -0
- data/lib/objects/voice.rb +20 -0
- data/lib/teleruby.rb +4 -40
- data/lib/teleruby/all_apis.rb +22 -0
- data/lib/teleruby/api/delete_apis.rb +58 -0
- data/lib/teleruby/api/get_apis.rb +172 -0
- data/lib/teleruby/api/nstandard.rb +27 -0
- data/lib/teleruby/api/other_apis.rb +241 -0
- data/lib/teleruby/api/send_apis.rb +206 -0
- data/lib/teleruby/api/set_apis.rb +137 -0
- data/lib/teleruby/core_api.rb +52 -0
- data/lib/teleruby/objects/all.rb +42 -0
- data/lib/teleruby/objects/animation.rb +40 -0
- data/lib/teleruby/objects/audio.rb +39 -0
- data/lib/teleruby/objects/bot_command.rb +24 -0
- data/lib/teleruby/objects/callback_query.rb +66 -0
- data/lib/teleruby/objects/chat.rb +164 -0
- data/lib/teleruby/objects/chat_member.rb +142 -0
- data/lib/teleruby/objects/chat_permissions.rb +59 -0
- data/lib/teleruby/objects/chat_photo.rb +37 -0
- data/lib/teleruby/objects/chosen_inline_result.rb +45 -0
- data/lib/teleruby/objects/contact.rb +37 -0
- data/lib/teleruby/objects/dice.rb +21 -0
- data/lib/teleruby/objects/document.rb +29 -0
- data/lib/teleruby/objects/file.rb +32 -0
- data/lib/teleruby/objects/game.rb +65 -0
- data/lib/teleruby/objects/inline_query.rb +44 -0
- data/lib/teleruby/objects/inlinekeyboardbutton.rb +59 -0
- data/lib/teleruby/objects/inlinekeyboardmarkup.rb +31 -0
- data/lib/teleruby/objects/location.rb +21 -0
- data/lib/teleruby/objects/mask_position.rb +35 -0
- data/lib/teleruby/objects/message.rb +400 -0
- data/lib/teleruby/objects/message_entity.rb +95 -0
- data/lib/teleruby/objects/order_info.rb +36 -0
- data/lib/teleruby/objects/photo_size.rb +14 -0
- data/lib/teleruby/objects/poll.rb +97 -0
- data/lib/teleruby/objects/poll_answer.rb +29 -0
- data/lib/teleruby/objects/poll_option.rb +22 -0
- data/lib/teleruby/objects/pre_checkout_query.rb +50 -0
- data/lib/teleruby/objects/same/common.rb +31 -0
- data/lib/teleruby/objects/same/common_2.rb +32 -0
- data/lib/teleruby/objects/shipping_address.rb +39 -0
- data/lib/teleruby/objects/shipping_query.rb +32 -0
- data/lib/teleruby/objects/sticker.rb +59 -0
- data/lib/teleruby/objects/update.rb +207 -0
- data/lib/teleruby/objects/user.rb +66 -0
- data/lib/teleruby/objects/user_profile_photos.rb +36 -0
- data/lib/teleruby/objects/venue.rb +40 -0
- data/lib/teleruby/objects/video.rb +39 -0
- data/lib/teleruby/objects/video_note.rb +50 -0
- data/lib/teleruby/objects/voice.rb +20 -0
- data/lib/teleruby/version.rb +3 -0
- data/msg.png +0 -0
- data/rdoc.png +0 -0
- data/teleruby.gemspec +9 -7
- metadata +109 -6
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative 'same/common_2'
|
5
|
+
require_relative 'photo_size'
|
6
|
+
|
7
|
+
##
|
8
|
+
# +Monday,+ +August+ +24+ +2020+
|
9
|
+
# ===This object represents an audio file to be treated as music by the Telegram clients.
|
10
|
+
class Audio < Common2
|
11
|
+
def initialize(audio) # :nodoc:
|
12
|
+
super(audio)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Duration of the audio in seconds as defined by sender.
|
16
|
+
def duration
|
17
|
+
@obj.duration
|
18
|
+
end
|
19
|
+
|
20
|
+
# +Optional.+ Performer of the audio as defined by sender or by audio tags.
|
21
|
+
def performer
|
22
|
+
@obj.performer
|
23
|
+
end
|
24
|
+
|
25
|
+
# +Optional+. Title of the audio as defined by sender or by audio tags
|
26
|
+
def title
|
27
|
+
@obj.title
|
28
|
+
end
|
29
|
+
|
30
|
+
# +Optional.+ Thumbnail of the album cover to which the music file belongs.
|
31
|
+
def thumb
|
32
|
+
data = @obj.thumb
|
33
|
+
unless data.nil?
|
34
|
+
return PhotoSize.new(data)
|
35
|
+
end
|
36
|
+
|
37
|
+
false
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# +Saturday+, +August+ +22+ +2020+ +EAT+
|
5
|
+
|
6
|
+
# ===This object represents a bot command
|
7
|
+
|
8
|
+
class BotCommand
|
9
|
+
def initialize(bot) # :nodoc:
|
10
|
+
@bot = bot
|
11
|
+
freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
# Text of the command, 1-32 characters. Can contain only lowercase
|
15
|
+
# English letters, digits and underscores.
|
16
|
+
def command
|
17
|
+
@bot.command
|
18
|
+
end
|
19
|
+
|
20
|
+
# Description of the command, 3-256 characters.
|
21
|
+
def description
|
22
|
+
@bot.description
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative 'user'
|
5
|
+
require_relative 'message'
|
6
|
+
|
7
|
+
##
|
8
|
+
# +Monday+, +August+ +24+ +2020+
|
9
|
+
# ===This object represents an incoming callback query from a callback button in an inline keyboard.
|
10
|
+
# If the button that originated the query was
|
11
|
+
# attached to a message sent by the bot, the field message will be present.
|
12
|
+
# If the button was attached to a message sent via the bot (in inline mode),
|
13
|
+
# the field inline_message_id will be present. Exactly one of the fields data
|
14
|
+
# or game_short_name will be present.
|
15
|
+
class CallbackQuery
|
16
|
+
def initialize(query) # :nodoc:
|
17
|
+
@query = query
|
18
|
+
end
|
19
|
+
|
20
|
+
# Unique identifier for this query.
|
21
|
+
def id
|
22
|
+
@query.id
|
23
|
+
end
|
24
|
+
|
25
|
+
# Sender. Returns User object
|
26
|
+
def from
|
27
|
+
User.new(@query.from)
|
28
|
+
end
|
29
|
+
|
30
|
+
# +Optional+. Message with the callback button that originated the query.
|
31
|
+
# Note that message content and message date will not be available if
|
32
|
+
# the message is too old.
|
33
|
+
def message
|
34
|
+
data = @query.message
|
35
|
+
unless data.nil?
|
36
|
+
return Message.new(data)
|
37
|
+
end
|
38
|
+
|
39
|
+
false
|
40
|
+
end
|
41
|
+
|
42
|
+
# +Optional.+ Identifier of the message sent via the bot in inline mode,
|
43
|
+
# that originated the query.
|
44
|
+
def inline_message_id
|
45
|
+
@query.inline_message_id
|
46
|
+
end
|
47
|
+
|
48
|
+
# Global identifier, uniquely corresponding to the chat to which the
|
49
|
+
# message with the callback button was sent. Useful for high scores
|
50
|
+
# in games.
|
51
|
+
def chat_instance
|
52
|
+
@query.chat_instance
|
53
|
+
end
|
54
|
+
|
55
|
+
# +Optional.+ Data associated with the callback button. Be aware that
|
56
|
+
# a bad client can send arbitrary data in this field.
|
57
|
+
def data
|
58
|
+
@query.data
|
59
|
+
end
|
60
|
+
|
61
|
+
# +Optional.+ Short name of a Game to be returned, serves as the unique
|
62
|
+
# identifier for the game
|
63
|
+
def game_short_name
|
64
|
+
@query.game_short_name
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative 'chat_permissions'
|
5
|
+
require_relative 'message'
|
6
|
+
require_relative 'chat_photo'
|
7
|
+
|
8
|
+
# +Sunday+, +August+ +23+ +2020+ +EAT+
|
9
|
+
|
10
|
+
# ===This object represents a chat.
|
11
|
+
class Chat
|
12
|
+
def initialize(chat) # :nodoc:
|
13
|
+
@chat = chat
|
14
|
+
end
|
15
|
+
|
16
|
+
# Unique identifier for this chat.
|
17
|
+
def id
|
18
|
+
@chat.id
|
19
|
+
end
|
20
|
+
|
21
|
+
# Type of chat, can be either +private+, +group+,
|
22
|
+
# +supergroup+ or +channel+.
|
23
|
+
def type
|
24
|
+
@chat.type
|
25
|
+
end
|
26
|
+
|
27
|
+
# +Optional+. *Title*, for +supergroups+, +channels+ and +group+ chats.
|
28
|
+
def title
|
29
|
+
@chat.title
|
30
|
+
end
|
31
|
+
|
32
|
+
# +Optional+. *Username*, for +private+ chats, +supergroups+ and
|
33
|
+
# +channels+ if available else nil is returned.
|
34
|
+
def username
|
35
|
+
@chat.username
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns true if chat type is private else false is returned.
|
39
|
+
def private?
|
40
|
+
type.eql? 'private'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns true if chat type is supergroup else false is returned.
|
44
|
+
def supergroup?
|
45
|
+
type.eql? 'supergroup'
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns true if chat type is channel else false is returned.
|
49
|
+
def channel?
|
50
|
+
type.eql? 'channel'
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns true if chat has title else false is returned.
|
54
|
+
def has_title?
|
55
|
+
title.nil?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# ====Returned only for private chat
|
60
|
+
# It extends from Chat class.
|
61
|
+
class PrivateChat < Chat
|
62
|
+
def initialize(chat) # :nodoc:
|
63
|
+
super(chat)
|
64
|
+
end
|
65
|
+
|
66
|
+
# +Optional+. First name of the other party in a +private+ chat.
|
67
|
+
def first_name
|
68
|
+
@chat.first_name
|
69
|
+
end
|
70
|
+
|
71
|
+
# +Optional.+ Last name of the other party in a +private+ chat.
|
72
|
+
def last_name
|
73
|
+
@chat.last_name
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# ==== This object is returned only in get_chat methods
|
78
|
+
# It extends from Chat class.
|
79
|
+
class GetChat < Chat
|
80
|
+
def initialize(chat) # :nodoc:
|
81
|
+
super(chat)
|
82
|
+
end
|
83
|
+
|
84
|
+
# +Optional+. Returns ChatPhoto if available else false is returned.
|
85
|
+
def photo
|
86
|
+
data = @chat.photo
|
87
|
+
unless data.nil?
|
88
|
+
return ChatPhoto.new(data)
|
89
|
+
end
|
90
|
+
|
91
|
+
false
|
92
|
+
end
|
93
|
+
|
94
|
+
# +Optional.+ Description, for +groups+, +supergroups+ and +channel+
|
95
|
+
# chats.
|
96
|
+
def description
|
97
|
+
@chat.description
|
98
|
+
end
|
99
|
+
|
100
|
+
# +Optional.+ Chat invite link, for +groups+, +supergroups+ and +channel+
|
101
|
+
# chats. Each administrator in a chat generates their own invite links,
|
102
|
+
# so the bot must first generate the link using +export_chat_link.+
|
103
|
+
def invite_link
|
104
|
+
@chat.invite_link
|
105
|
+
end
|
106
|
+
|
107
|
+
# +Optional+. Pinned message, for +groups+, +supergroups+ and +channels.+
|
108
|
+
# Returns Message object.
|
109
|
+
def pinned_message
|
110
|
+
data = @chat.pinned_message
|
111
|
+
unless data.nil?
|
112
|
+
return Message.new(data)
|
113
|
+
end
|
114
|
+
|
115
|
+
false
|
116
|
+
end
|
117
|
+
|
118
|
+
# +Optional.+ Default chat member permissions, for +groups+ and
|
119
|
+
# +supergroups+. Returns ChatPermissions object.
|
120
|
+
def permissions
|
121
|
+
data = @chat.permissions
|
122
|
+
unless data.nil?
|
123
|
+
return ChatPermissions.new(data)
|
124
|
+
end
|
125
|
+
|
126
|
+
false
|
127
|
+
end
|
128
|
+
|
129
|
+
# +Optional.+ For +supergroups,+ the minimum allowed delay between
|
130
|
+
# consecutive messages sent by each unpriviledged user.
|
131
|
+
def slow_mode_delay
|
132
|
+
@chat.slow_mode_delay
|
133
|
+
end
|
134
|
+
|
135
|
+
# +Optional.+ For +supergroups,+ name of group sticker set.
|
136
|
+
def sticker_set_name
|
137
|
+
@chat.sticker_set_name
|
138
|
+
end
|
139
|
+
|
140
|
+
# +Optional.+ True, if the bot can change the group sticker set.
|
141
|
+
def can_set_sticker_set?
|
142
|
+
@chat.can_set_sticker_set
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns true if photo is set to chat else false is returned.
|
146
|
+
def has_photo?
|
147
|
+
photo ? true : false
|
148
|
+
end
|
149
|
+
|
150
|
+
# Returns true if description is set to chat else false is returned.
|
151
|
+
def has_description?
|
152
|
+
description.nil?
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns true if message is pinned in chat else false is returned.
|
156
|
+
def pinned_message?
|
157
|
+
pinned_message ? true : false
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns true if slow mode delay is set in chat.
|
161
|
+
def slow_mode_delay_set?
|
162
|
+
slow_mode_delay.nil?
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative 'user'
|
5
|
+
|
6
|
+
##
|
7
|
+
# +Monday+, +August+ +24+ +2020+ +EAT+
|
8
|
+
# ===This object contains information about one member of a chat.
|
9
|
+
class ChatMember
|
10
|
+
def initialize(mem) # :nodoc:
|
11
|
+
@memb = mem
|
12
|
+
end
|
13
|
+
|
14
|
+
# Information about the user.
|
15
|
+
# Return User object.
|
16
|
+
def user
|
17
|
+
User.new(@memb.user)
|
18
|
+
end
|
19
|
+
|
20
|
+
# The member's status in the chat. Can be +creator+, +administrator+,
|
21
|
+
# +member+, +restricted+, +left+ or +kicked+.
|
22
|
+
def status
|
23
|
+
@memb.status
|
24
|
+
end
|
25
|
+
|
26
|
+
# +Optional.+ Owner and administrators only. Custom title for this user.
|
27
|
+
# check if user is admin using #admin? before going to use this method,
|
28
|
+
# unless nil is returned.
|
29
|
+
def custom_title
|
30
|
+
@memb.custom_title
|
31
|
+
end
|
32
|
+
|
33
|
+
# +Optional.+ Restricted and kicked only. Date when restrictions will be
|
34
|
+
# lifted for this user; unix time.
|
35
|
+
# Check if user is restricted or kicked using #member? before going to use
|
36
|
+
# this method else if user is not kicked or restricted then nil is returned.
|
37
|
+
def until_date
|
38
|
+
@memb.until_date
|
39
|
+
end
|
40
|
+
|
41
|
+
# +Optional.+ Administrators only. True, if the bot is allowed to edit
|
42
|
+
# administrator privileges of that user.
|
43
|
+
def can_be_edited?
|
44
|
+
@memb.can_be_edited
|
45
|
+
end
|
46
|
+
|
47
|
+
# +Optional.+ Administrators only. True, if the administrator can post in
|
48
|
+
# the channel; channels only.
|
49
|
+
def can_post_messages?
|
50
|
+
@memb.can_post_messages
|
51
|
+
end
|
52
|
+
|
53
|
+
# +Optional.+ Administrators only. True, if the administrator can edit
|
54
|
+
# messages of other users and can pin messages; channels only.
|
55
|
+
def can_edit_messages?
|
56
|
+
@memb.can_edit_messages
|
57
|
+
end
|
58
|
+
|
59
|
+
# +Optional.+ Administrators only. True, if the administrator can delete
|
60
|
+
# messages of other users.
|
61
|
+
def can_delete_messages?
|
62
|
+
@memb.can_delete_messages
|
63
|
+
end
|
64
|
+
|
65
|
+
# +Optional.+ Administrators only. True, if the administrator can restrict,
|
66
|
+
# #ban_chat_member or #unban_chat_member s.
|
67
|
+
def can_restrict_members?
|
68
|
+
@memb.can_restrict_members
|
69
|
+
end
|
70
|
+
|
71
|
+
# +Optional.+ Administrators only. True, if the administrator can add new
|
72
|
+
# administrators with a subset of their own privileges or demote
|
73
|
+
# administrators that he has promoted, directly or indirectly
|
74
|
+
# (promoted by administrators that were appointed by the user)
|
75
|
+
def can_promote_members?
|
76
|
+
@memb.can_promote_members
|
77
|
+
end
|
78
|
+
|
79
|
+
# +Optional.+ Administrators and restricted only. True, if the user is
|
80
|
+
# allowed to change the chat title, photo and other settings.
|
81
|
+
def can_change_info?
|
82
|
+
@memb.can_change_info
|
83
|
+
end
|
84
|
+
|
85
|
+
# +Optional.+ Administrators and restricted only. True, if the user
|
86
|
+
# is allowed to invite new users to the chat.
|
87
|
+
def can_invite_users?
|
88
|
+
@memb.can_invite_users
|
89
|
+
end
|
90
|
+
|
91
|
+
# +Optional.+ Administrators and restricted only. True, if the user is
|
92
|
+
# allowed to pin messages; groups and supergroups only.
|
93
|
+
def can_pin_messages?
|
94
|
+
@memb.can_pin_messages
|
95
|
+
end
|
96
|
+
|
97
|
+
# +Optional.+ Restricted only. True, if the user is a member of the
|
98
|
+
# chat at the moment of the reques.
|
99
|
+
def member?
|
100
|
+
@memb.is_member
|
101
|
+
end
|
102
|
+
|
103
|
+
# +Optional+. Restricted only. True, if the user is allowed to send text
|
104
|
+
# messages, contacts, locations and venues.
|
105
|
+
def can_send_messages?
|
106
|
+
@memb.can_send_messages
|
107
|
+
end
|
108
|
+
|
109
|
+
# +Optional+. Restricted only. True, if the user is allowed to send
|
110
|
+
# audios, documents, photos, videos, video notes and voice notes.
|
111
|
+
def can_send_media_messages?
|
112
|
+
@memb.can_send_media_messages
|
113
|
+
end
|
114
|
+
|
115
|
+
# +Optional.+ Restricted only. True, if the user is allowed to send polls
|
116
|
+
def can_send_polls?
|
117
|
+
@memb.can_send_polls
|
118
|
+
end
|
119
|
+
|
120
|
+
# +Optional.+ Restricted only. True, if the user is allowed to send
|
121
|
+
# animations, games, stickers and use inline bots.
|
122
|
+
def can_send_other_messages?
|
123
|
+
@memb.can_send_other_messages
|
124
|
+
end
|
125
|
+
|
126
|
+
# +Optional.+ Restricted only. True, if the user is allowed to add
|
127
|
+
# web page previews to their messages.
|
128
|
+
def can_add_web_page_previews?
|
129
|
+
@memb.can_add_web_page_previews
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returns true if user if left the chat. +NB:+ That does not mean it
|
133
|
+
# checks if user is a part of chat. Kicked != left
|
134
|
+
def left?
|
135
|
+
status.eql? 'left'
|
136
|
+
end
|
137
|
+
|
138
|
+
# Returns true if user is admin
|
139
|
+
def admin?
|
140
|
+
(status.eql? 'creator') || (status.eql? 'administrator')
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
##
|
5
|
+
# +Monday+, +August+ +24+ +2020+ +EAT+
|
6
|
+
# ===Describes actions that a non-administrator user is allowed to take in a chat.
|
7
|
+
class ChatPermissions
|
8
|
+
def initialize(perm) # :nodoc:
|
9
|
+
@perm = perm
|
10
|
+
end
|
11
|
+
|
12
|
+
# +Optional+. True, if the user is allowed to send text messages, contacts,
|
13
|
+
# locations and venues.
|
14
|
+
def can_send_messages?
|
15
|
+
@perm.can_send_messages
|
16
|
+
end
|
17
|
+
|
18
|
+
# +Optional.+ True, if the user is allowed to send +audios+, +documents+,
|
19
|
+
# +photos,+ +videos+, +video_notes+ and +voice_notes,+
|
20
|
+
# implies can_send_messages.
|
21
|
+
def can_send_media_messages?
|
22
|
+
@perm.can_send_media_messages
|
23
|
+
end
|
24
|
+
|
25
|
+
# +Optional+. True, if the user is allowed to +send_polls+, implies
|
26
|
+
# +can_send_messages?+
|
27
|
+
def can_send_polls?
|
28
|
+
@perm.can_send_polls
|
29
|
+
end
|
30
|
+
|
31
|
+
# +Optional.+ True, if the user is allowed to send animations, games
|
32
|
+
# stickers and use inline bots, implies can_send_media_messages
|
33
|
+
def can_send_other_messages?
|
34
|
+
@perm.can_send_other_messages
|
35
|
+
end
|
36
|
+
|
37
|
+
# +Optional.+ True, if the user is allowed to add web page previews to
|
38
|
+
# their messages, implies +can_send_media_messages?+
|
39
|
+
def can_add_web_page_previews?
|
40
|
+
@perm.can_add_web_page_previews
|
41
|
+
end
|
42
|
+
|
43
|
+
# +Optional.+ True, if the user is allowed to change the chat title,
|
44
|
+
# photo and other settings. Ignored in public supergroups.
|
45
|
+
def can_change_info?
|
46
|
+
@perm.can_change_info
|
47
|
+
end
|
48
|
+
|
49
|
+
# +Optional.+ True, if the user is allowed to invite new users to the chat.
|
50
|
+
def can_invite_users?
|
51
|
+
@perm.can_invite_users
|
52
|
+
end
|
53
|
+
|
54
|
+
# +Optional.+ True, if the user is allowed to pin messages.
|
55
|
+
# Ignored in public supergroups.
|
56
|
+
def can_pin_messages?
|
57
|
+
@perm.can_pin_messages
|
58
|
+
end
|
59
|
+
end
|