Skip to content

Commit

Permalink
Merge pull request #306 from TelegramBot/feature/types
Browse files Browse the repository at this point in the history
Update types
  • Loading branch information
MyZik authored Jan 13, 2021
2 parents 3d75d0c + fbcf948 commit 6a77fc4
Show file tree
Hide file tree
Showing 10 changed files with 728 additions and 40 deletions.
137 changes: 121 additions & 16 deletions src/Types/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ class Chat extends BaseType implements TypeInterface
'username' => true,
'first_name' => true,
'last_name' => true,
'all_members_are_administrators' => true,
'photo' => ChatPhoto::class,
'bio' => true,
'description' => true,
'invite_link' => true,
'pinned_message' => Message::class,
'permissions' => ChatPermissions::class,
'slow_mode_delay' => true,
'sticker_set_name' => true,
'can_set_sticker_set' => true
'can_set_sticker_set' => true,
'linked_chat_id' => true,
'location' => ChatLocation::class
];

/**
Expand Down Expand Up @@ -78,15 +82,20 @@ class Chat extends BaseType implements TypeInterface
*/
protected $lastName;

protected $allMembersAreAdministrators;

/**
* Optional. Chat photo. Returned only in getChat.
*
* @var ChatPhoto
*/
protected $photo;

/**
* Optional. Bio of the other party in a private chat. Returned only in getChat
*
* @var string
*/
protected $bio;

/**
* Optional. Description, for supergroups and channel chats. Returned only in getChat.
*
Expand All @@ -108,6 +117,21 @@ class Chat extends BaseType implements TypeInterface
*/
protected $pinnedMessage;

/**
* Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
*
* @var ChatPermissions
*/
protected $permissions;

/**
* Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged
* user. Returned only in getChat.
*
* @var int
*/
protected $slowModeDelay;

/**
* Optional. For supergroups, name of group sticker set. Returned only in getChat.
*
Expand All @@ -122,6 +146,23 @@ class Chat extends BaseType implements TypeInterface
*/
protected $canSetStickerSet;

/**
* Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice
* versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming
* languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64
* bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
*
* @var int
*/
protected $linkedChatId;

/**
* Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
*
* @var ChatLocation
*/
protected $location;

/**
* @return int|string
*/
Expand Down Expand Up @@ -225,35 +266,35 @@ public function setLastName($lastName)
}

/**
* @return mixed
* @return ChatPhoto
*/
public function getAllMembersAreAdministrators()
public function getPhoto()
{
return $this->allMembersAreAdministrators;
return $this->photo;
}

/**
* @param mixed $allMembersAreAdministrators
* @param ChatPhoto $photo
*/
public function setAllMembersAreAdministrators($allMembersAreAdministrators)
public function setPhoto($photo)
{
$this->allMembersAreAdministrators = $allMembersAreAdministrators;
$this->photo = $photo;
}

/**
* @return ChatPhoto
* @return string
*/
public function getPhoto()
public function getBio()
{
return $this->photo;
return $this->bio;
}

/**
* @param ChatPhoto $photo
* @param string $bio
*/
public function setPhoto($photo)
public function setBio($bio)
{
$this->photo = $photo;
$this->bio = $bio;
}

/**
Expand Down Expand Up @@ -304,6 +345,38 @@ public function setPinnedMessage($pinnedMessage)
$this->pinnedMessage = $pinnedMessage;
}

/**
* @return ChatPermissions
*/
public function getPermissions()
{
return $this->permissions;
}

/**
* @param ChatPermissions $permissions
*/
public function setPermissions($permissions)
{
$this->permissions = $permissions;
}

/**
* @return int
*/
public function getSlowModeDelay()
{
return $this->slowModeDelay;
}

/**
* @param int $slowModeDelay
*/
public function setSlowModeDelay($slowModeDelay)
{
$this->slowModeDelay = $slowModeDelay;
}

/**
* @return string
*/
Expand Down Expand Up @@ -335,4 +408,36 @@ public function setCanSetStickerSet($canSetStickerSet)
{
$this->canSetStickerSet = $canSetStickerSet;
}

/**
* @return int
*/
public function getLinkedChatId()
{
return $this->linkedChatId;
}

/**
* @param int $linkedChatId
*/
public function setLinkedChatId($linkedChatId)
{
$this->linkedChatId = $linkedChatId;
}

/**
* @return ChatLocation
*/
public function getLocation()
{
return $this->location;
}

/**
* @param ChatLocation $location
*/
public function setLocation($location)
{
$this->location = $location;
}
}
72 changes: 72 additions & 0 deletions src/Types/ChatLocation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace TelegramBot\Api\Types;

use TelegramBot\Api\BaseType;
use TelegramBot\Api\TypeInterface;

class ChatLocation extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['location', 'address'];

/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'location' => Location::class,
'address' => true,
];

/**
* The location to which the supergroup is connected. Can't be a live location.
*
* @var Location
*/
protected $location;

/**
* Location address; 1-64 characters, as defined by the chat owner
*
* @var string
*/
protected $address;

/**
* @return Location
*/
public function getLocation()
{
return $this->location;
}

/**
* @param Location $location
*/
public function setLocation($location)
{
$this->location = $location;
}

/**
* @return string
*/
public function getAddress()
{
return $this->address;
}

/**
* @param string $address
*/
public function setAddress($address)
{
$this->address = $address;
}
}
Loading

0 comments on commit 6a77fc4

Please sign in to comment.