Passed
Push — main ( bd6751...4aef09 )
by Miaad
10:17
created

message   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 337
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 115
c 1
b 0
f 0
dl 0
loc 337
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 2 1
A __construct() 0 3 2
1
<?php
2
3
namespace BPT\types;
4
5
use BPT\telegram\telegram;
6
use stdClass;
7
8
/**
9
 * This object represents a message.
10
 */
11
class message extends types {
0 ignored issues
show
Bug introduced by
The type BPT\types\types was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
    /** Keep all of properties which has sub properties */
13
    private const subs = [
14
        'from' => 'BPT\types\user',
15
        'sender_chat' => 'BPT\types\chat',
16
        'chat' => 'BPT\types\chat',
17
        'forward_from' => 'BPT\types\user',
18
        'forward_from_chat' => 'BPT\types\chat',
19
        'reply_to_message' => 'BPT\types\message',
20
        'via_bot' => 'BPT\types\user',
21
        'array' => [
22
            'entities' => 'BPT\types\messageEntity',
23
            'photo' => 'BPT\types\photoSize',
24
            'caption_entities' => 'BPT\types\messageEntity',
25
            'new_chat_members' => 'BPT\types\user',
26
            'new_chat_photo' => 'BPT\types\photoSize',
27
        ],
28
        'animation' => 'BPT\types\animation',
29
        'audio' => 'BPT\types\audio',
30
        'document' => 'BPT\types\document',
31
        'sticker' => 'BPT\types\sticker',
32
        'video' => 'BPT\types\video',
33
        'video_note' => 'BPT\types\videoNote',
34
        'voice' => 'BPT\types\voice',
35
        'contact' => 'BPT\types\contact',
36
        'dice' => 'BPT\types\dice',
37
        'game' => 'BPT\types\game',
38
        'poll' => 'BPT\types\poll',
39
        'venue' => 'BPT\types\venue',
40
        'location' => 'BPT\types\location',
41
        'left_chat_member' => 'BPT\types\user',
42
        'message_auto_delete_timer_changed' => 'BPT\types\messageAutoDeleteTimerChanged',
43
        'pinned_message' => 'BPT\types\message',
44
        'invoice' => 'BPT\types\invoice',
45
        'successful_payment' => 'BPT\types\successfulPayment',
46
        'passport_data' => 'BPT\types\passportData',
47
        'proximity_alert_triggered' => 'BPT\types\proximityAlertTriggered',
48
        'forum_topic_created' => 'BPT\types\forumTopicCreated',
49
        'forum_topic_closed' => 'BPT\types\forumTopicClosed',
50
        'forum_topic_reopened' => 'BPT\types\forumTopicReopened',
51
        'video_chat_scheduled' => 'BPT\types\videoChatScheduled',
52
        'video_chat_started' => 'BPT\types\videoChatStarted',
53
        'video_chat_ended' => 'BPT\types\videoChatEnded',
54
        'video_chat_participants_invited' => 'BPT\types\videoChatParticipantsInvited',
55
        'web_app_data' => 'BPT\types\webAppData',
56
        'reply_markup' => 'BPT\types\inlineKeyboardMarkup',
57
    ];
58
59
    /** Unique message identifier inside this chat */
60
    public int $id;
61
62
    /** Unique message identifier inside this chat */
63
    public int $message_id;
64
65
    /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */
66
    public null|int $message_thread_id = null;
67
68
    /**
69
     * Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field
70
     * contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
71
     */
72
    public null|user $from = null;
73
74
    /**
75
     * Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts,
76
     * the supergroup itself for messages from anonymous group administrators, the linked channel for messages
77
     * automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake
78
     * sender user in non-channel chats, if the message was sent on behalf of a chat.
79
     */
80
    public null|chat $sender_chat = null;
81
82
    /** Date the message was sent in Unix time */
83
    public int $date;
84
85
    /** Conversation the message belongs to */
86
    public chat $chat;
87
88
    /** Optional. For forwarded messages, sender of the original message */
89
    public null|user $forward_from = null;
90
91
    /**
92
     * Optional. For messages forwarded from channels or from anonymous administrators, information about the
93
     * original sender chat
94
     */
95
    public null|chat $forward_from_chat = null;
96
97
    /** Optional. For messages forwarded from channels, identifier of the original message in the channel */
98
    public null|int $forward_from_message_id = null;
99
100
    /**
101
     * Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator,
102
     * signature of the message sender if present
103
     */
104
    public null|string $forward_signature = null;
105
106
    /**
107
     * Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in
108
     * forwarded messages
109
     */
110
    public null|string $forward_sender_name = null;
111
112
    /** Optional. For forwarded messages, date the original message was sent in Unix time */
113
    public null|int $forward_date = null;
114
115
    /** Optional. True, if the message is sent to a forum topic */
116
    public null|bool $is_topic_message = null;
117
118
    /**
119
     * Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion
120
     * group
121
     */
122
    public null|bool $is_automatic_forward = null;
123
124
    /**
125
     * Optional. For replies, the original message. Note that the Message object in this field will not contain
126
     * further reply_to_message fields even if it itself is a reply.
127
     */
128
    public null|message $reply_to_message = null;
129
130
    /** Optional. Bot through which the message was sent */
131
    public null|user $via_bot = null;
132
133
    /** Optional. Date the message was last edited in Unix time */
134
    public null|int $edit_date = null;
135
136
    /** Optional. True, if the message can't be forwarded */
137
    public null|bool $has_protected_content = null;
138
139
    /** Optional. The unique identifier of a media message group this message belongs to */
140
    public null|string $media_group_id = null;
141
142
    /**
143
     * Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group
144
     * administrator
145
     */
146
    public null|string $author_signature = null;
147
148
    /** Optional. For text messages, the actual UTF-8 text of the message */
149
    public null|string $text = null;
150
151
    /** Optional. If user message was a commend , this parameter will be the commend */
152
    public string|null $commend = null;
153
154
    /** Optional. If user message was a commend , this parameter will be the commend username(if exist) */
155
    public string|null $commend_username = null;
156
157
    /** Optional. If user message was a commend , this parameter will be the commend payload(if exist) */
158
    public string|null $commend_payload = null;
159
160
    /**
161
     * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
162
     * @var messageEntity[]
163
     */
164
    public null|array $entities = null;
165
166
    /**
167
     * Optional. Message is an animation, information about the animation. For backward compatibility, when this
168
     * field is set, the document field will also be set
169
     */
170
    public null|animation $animation = null;
171
172
    /** Optional. Message is an audio file, information about the file */
173
    public null|audio $audio = null;
174
175
    /** Optional. Message is a general file, information about the file */
176
    public null|document $document = null;
177
178
    /**
179
     * Optional. Message is a photo, available sizes of the photo
180
     * @var photoSize[]
181
     */
182
    public null|array $photo = null;
183
184
    /** Optional. Message is a sticker, information about the sticker */
185
    public null|sticker $sticker = null;
186
187
    /** Optional. Message is a video, information about the video */
188
    public null|video $video = null;
189
190
    /** Optional. Message is a video note, information about the video message */
191
    public null|videoNote $video_note = null;
192
193
    /** Optional. Message is a voice message, information about the file */
194
    public null|voice $voice = null;
195
196
    /** Optional. Caption for the animation, audio, document, photo, video or voice */
197
    public null|string $caption = null;
198
199
    /**
200
     * Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
201
     * in the caption
202
     * @var messageEntity[]
203
     */
204
    public null|array $caption_entities = null;
205
206
    /** Optional. Message is a shared contact, information about the contact */
207
    public null|contact $contact = null;
208
209
    /** Optional. Message is a dice with random value */
210
    public null|dice $dice = null;
211
212
    /** Optional. Message is a game, information about the game. More about games » */
213
    public null|game $game = null;
214
215
    /** Optional. Message is a native poll, information about the poll */
216
    public null|poll $poll = null;
217
218
    /**
219
     * Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set,
220
     * the location field will also be set
221
     */
222
    public null|venue $venue = null;
223
224
    /** Optional. Message is a shared location, information about the location */
225
    public null|location $location = null;
226
227
    /**
228
     * Optional. New members that were added to the group or supergroup and information about them (the bot itself
229
     * may be one of these members)
230
     * @var user[]
231
     */
232
    public null|array $new_chat_members = null;
233
234
    /** Optional. A member was removed from the group, information about them (this member may be the bot itself) */
235
    public null|user $left_chat_member = null;
236
237
    /** Optional. A chat title was changed to this value */
238
    public null|string $new_chat_title = null;
239
240
    /**
241
     * Optional. A chat photo was change to this value
242
     * @var photoSize[]
243
     */
244
    public null|array $new_chat_photo = null;
245
246
    /** Optional. Service message: the chat photo was deleted */
247
    public null|bool $delete_chat_photo = null;
248
249
    /** Optional. Service message: the group has been created */
250
    public null|bool $group_chat_created = null;
251
252
    /**
253
     * Optional. Service message: the supergroup has been created. This field can't be received in a message coming
254
     * through updates, because bot can't be a member of a supergroup when it is created. It can only be found in
255
     * reply_to_message if someone replies to a very first message in a directly created supergroup.
256
     */
257
    public null|bool $supergroup_chat_created = null;
258
259
    /**
260
     * Optional. Service message: the channel has been created. This field can't be received in a message coming
261
     * through updates, because bot can't be a member of a channel when it is created. It can only be found in
262
     * reply_to_message if someone replies to a very first message in a channel.
263
     */
264
    public null|bool $channel_chat_created = null;
265
266
    /** Optional. Service message: auto-delete timer settings changed in the chat */
267
    public null|messageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null;
268
269
    /**
270
     * Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more
271
     * than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
272
     * But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for
273
     * storing this identifier.
274
     */
275
    public null|int $migrate_to_chat_id = null;
276
277
    /**
278
     * Optional. The supergroup has been migrated from a group with the specified identifier. This number may have
279
     * more than 32 significant bits and some programming languages may have difficulty/silent defects in
280
     * interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float
281
     * type are safe for storing this identifier.
282
     */
283
    public null|int $migrate_from_chat_id = null;
284
285
    /**
286
     * Optional. Specified message was pinned. Note that the Message object in this field will not contain further
287
     * reply_to_message fields even if it is itself a reply.
288
     */
289
    public null|message $pinned_message = null;
290
291
    /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */
292
    public null|invoice $invoice = null;
293
294
    /**
295
     * Optional. Message is a service message about a successful payment, information about the payment. More about
296
     * payments »
297
     */
298
    public null|successfulPayment $successful_payment = null;
299
300
    /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */
301
    public null|string $connected_website = null;
302
303
    /** Optional. Telegram Passport data */
304
    public null|passportData $passport_data = null;
305
306
    /**
307
     * Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live
308
     * Location.
309
     */
310
    public null|proximityAlertTriggered $proximity_alert_triggered = null;
311
312
    /** Optional. Service message: forum topic created */
313
    public null|forumTopicCreated $forum_topic_created = null;
314
315
    /** Optional. Service message: forum topic closed */
316
    public null|forumTopicClosed $forum_topic_closed = null;
317
318
    /** Optional. Service message: forum topic reopened */
319
    public null|forumTopicReopened $forum_topic_reopened = null;
320
321
    /** Optional. Service message: video chat scheduled */
322
    public null|videoChatScheduled $video_chat_scheduled = null;
323
324
    /** Optional. Service message: video chat started */
325
    public null|videoChatStarted $video_chat_started = null;
326
327
    /** Optional. Service message: video chat ended */
328
    public null|videoChatEnded $video_chat_ended = null;
329
330
    /** Optional. Service message: new participants invited to a video chat */
331
    public null|videoChatParticipantsInvited $video_chat_participants_invited = null;
332
333
    /** Optional. Service message: data sent by a Web App */
334
    public null|webAppData $web_app_data = null;
335
336
    /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
337
    public null|inlineKeyboardMarkup $reply_markup = null;
338
339
340
    public function __construct(stdClass|null $object = null) {
341
        if ($object != null) {
342
            parent::__construct($object, self::subs);
343
        }
344
    }
345
346
    public function delete (): responseError|bool {
347
        return telegram::deleteMessage($this->chat->id,$this->id);
348
    }
349
}
350