Skip to content

Commit 6a77fc4

Browse files
authored
Merge pull request #306 from TelegramBot/feature/types
Update types
2 parents 3d75d0c + fbcf948 commit 6a77fc4

File tree

10 files changed

+728
-40
lines changed

10 files changed

+728
-40
lines changed

src/Types/Chat.php

Lines changed: 121 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ class Chat extends BaseType implements TypeInterface
2727
'username' => true,
2828
'first_name' => true,
2929
'last_name' => true,
30-
'all_members_are_administrators' => true,
3130
'photo' => ChatPhoto::class,
31+
'bio' => true,
3232
'description' => true,
3333
'invite_link' => true,
3434
'pinned_message' => Message::class,
35+
'permissions' => ChatPermissions::class,
36+
'slow_mode_delay' => true,
3537
'sticker_set_name' => true,
36-
'can_set_sticker_set' => true
38+
'can_set_sticker_set' => true,
39+
'linked_chat_id' => true,
40+
'location' => ChatLocation::class
3741
];
3842

3943
/**
@@ -78,15 +82,20 @@ class Chat extends BaseType implements TypeInterface
7882
*/
7983
protected $lastName;
8084

81-
protected $allMembersAreAdministrators;
82-
8385
/**
8486
* Optional. Chat photo. Returned only in getChat.
8587
*
8688
* @var ChatPhoto
8789
*/
8890
protected $photo;
8991

92+
/**
93+
* Optional. Bio of the other party in a private chat. Returned only in getChat
94+
*
95+
* @var string
96+
*/
97+
protected $bio;
98+
9099
/**
91100
* Optional. Description, for supergroups and channel chats. Returned only in getChat.
92101
*
@@ -108,6 +117,21 @@ class Chat extends BaseType implements TypeInterface
108117
*/
109118
protected $pinnedMessage;
110119

120+
/**
121+
* Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
122+
*
123+
* @var ChatPermissions
124+
*/
125+
protected $permissions;
126+
127+
/**
128+
* Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged
129+
* user. Returned only in getChat.
130+
*
131+
* @var int
132+
*/
133+
protected $slowModeDelay;
134+
111135
/**
112136
* Optional. For supergroups, name of group sticker set. Returned only in getChat.
113137
*
@@ -122,6 +146,23 @@ class Chat extends BaseType implements TypeInterface
122146
*/
123147
protected $canSetStickerSet;
124148

149+
/**
150+
* Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice
151+
* versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming
152+
* languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64
153+
* bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
154+
*
155+
* @var int
156+
*/
157+
protected $linkedChatId;
158+
159+
/**
160+
* Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
161+
*
162+
* @var ChatLocation
163+
*/
164+
protected $location;
165+
125166
/**
126167
* @return int|string
127168
*/
@@ -225,35 +266,35 @@ public function setLastName($lastName)
225266
}
226267

227268
/**
228-
* @return mixed
269+
* @return ChatPhoto
229270
*/
230-
public function getAllMembersAreAdministrators()
271+
public function getPhoto()
231272
{
232-
return $this->allMembersAreAdministrators;
273+
return $this->photo;
233274
}
234275

235276
/**
236-
* @param mixed $allMembersAreAdministrators
277+
* @param ChatPhoto $photo
237278
*/
238-
public function setAllMembersAreAdministrators($allMembersAreAdministrators)
279+
public function setPhoto($photo)
239280
{
240-
$this->allMembersAreAdministrators = $allMembersAreAdministrators;
281+
$this->photo = $photo;
241282
}
242283

243284
/**
244-
* @return ChatPhoto
285+
* @return string
245286
*/
246-
public function getPhoto()
287+
public function getBio()
247288
{
248-
return $this->photo;
289+
return $this->bio;
249290
}
250291

251292
/**
252-
* @param ChatPhoto $photo
293+
* @param string $bio
253294
*/
254-
public function setPhoto($photo)
295+
public function setBio($bio)
255296
{
256-
$this->photo = $photo;
297+
$this->bio = $bio;
257298
}
258299

259300
/**
@@ -304,6 +345,38 @@ public function setPinnedMessage($pinnedMessage)
304345
$this->pinnedMessage = $pinnedMessage;
305346
}
306347

348+
/**
349+
* @return ChatPermissions
350+
*/
351+
public function getPermissions()
352+
{
353+
return $this->permissions;
354+
}
355+
356+
/**
357+
* @param ChatPermissions $permissions
358+
*/
359+
public function setPermissions($permissions)
360+
{
361+
$this->permissions = $permissions;
362+
}
363+
364+
/**
365+
* @return int
366+
*/
367+
public function getSlowModeDelay()
368+
{
369+
return $this->slowModeDelay;
370+
}
371+
372+
/**
373+
* @param int $slowModeDelay
374+
*/
375+
public function setSlowModeDelay($slowModeDelay)
376+
{
377+
$this->slowModeDelay = $slowModeDelay;
378+
}
379+
307380
/**
308381
* @return string
309382
*/
@@ -335,4 +408,36 @@ public function setCanSetStickerSet($canSetStickerSet)
335408
{
336409
$this->canSetStickerSet = $canSetStickerSet;
337410
}
411+
412+
/**
413+
* @return int
414+
*/
415+
public function getLinkedChatId()
416+
{
417+
return $this->linkedChatId;
418+
}
419+
420+
/**
421+
* @param int $linkedChatId
422+
*/
423+
public function setLinkedChatId($linkedChatId)
424+
{
425+
$this->linkedChatId = $linkedChatId;
426+
}
427+
428+
/**
429+
* @return ChatLocation
430+
*/
431+
public function getLocation()
432+
{
433+
return $this->location;
434+
}
435+
436+
/**
437+
* @param ChatLocation $location
438+
*/
439+
public function setLocation($location)
440+
{
441+
$this->location = $location;
442+
}
338443
}

src/Types/ChatLocation.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace TelegramBot\Api\Types;
4+
5+
use TelegramBot\Api\BaseType;
6+
use TelegramBot\Api\TypeInterface;
7+
8+
class ChatLocation extends BaseType implements TypeInterface
9+
{
10+
/**
11+
* {@inheritdoc}
12+
*
13+
* @var array
14+
*/
15+
static protected $requiredParams = ['location', 'address'];
16+
17+
/**
18+
* {@inheritdoc}
19+
*
20+
* @var array
21+
*/
22+
static protected $map = [
23+
'location' => Location::class,
24+
'address' => true,
25+
];
26+
27+
/**
28+
* The location to which the supergroup is connected. Can't be a live location.
29+
*
30+
* @var Location
31+
*/
32+
protected $location;
33+
34+
/**
35+
* Location address; 1-64 characters, as defined by the chat owner
36+
*
37+
* @var string
38+
*/
39+
protected $address;
40+
41+
/**
42+
* @return Location
43+
*/
44+
public function getLocation()
45+
{
46+
return $this->location;
47+
}
48+
49+
/**
50+
* @param Location $location
51+
*/
52+
public function setLocation($location)
53+
{
54+
$this->location = $location;
55+
}
56+
57+
/**
58+
* @return string
59+
*/
60+
public function getAddress()
61+
{
62+
return $this->address;
63+
}
64+
65+
/**
66+
* @param string $address
67+
*/
68+
public function setAddress($address)
69+
{
70+
$this->address = $address;
71+
}
72+
}

0 commit comments

Comments
 (0)