Skip to content

Commit dd7c824

Browse files
committed
Add setChatTitle, setChatDescription, pinChatMessage and unpinChatMessage api methods
1 parent fdceed2 commit dd7c824

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

Telegram.php

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,135 @@ public function deleteChatPhoto(array $content)
22242224
{
22252225
return $this->endpoint('deleteChatPhoto', $content);
22262226
}
2227+
2228+
// Set Chat Title
2229+
2230+
/**
2231+
* Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.
2232+
* <table>
2233+
* <tr>
2234+
* <td><strong>Parameters</strong></td>
2235+
* <td><strong>Type</strong></td>
2236+
* <td><strong>Required</strong></td>
2237+
* <td><strong>Description</strong></td>
2238+
* </tr>
2239+
* <tr>
2240+
* <td>chat_id</td>
2241+
* <td>Integer or String</td>
2242+
* <td>Yes</td>
2243+
* <td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>
2244+
* </tr>
2245+
* <tr>
2246+
* <td>title</td>
2247+
* <td>String</td>
2248+
* <td>Yes</td>
2249+
* <td>New chat title, 1-255 characters</td>
2250+
* </tr>
2251+
* </table>
2252+
* \param $content the request parameters as array
2253+
* \return the JSON Telegram's reply.
2254+
*/
2255+
public function setChatTitle(array $content)
2256+
{
2257+
return $this->endpoint('setChatTitle', $content);
2258+
}
2259+
2260+
// Set Chat Description
2261+
2262+
/**
2263+
* Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2264+
* <table>
2265+
* <tr>
2266+
* <td><strong>Parameters</strong></td>
2267+
* <td><strong>Type</strong></td>
2268+
* <td><strong>Required</strong></td>
2269+
* <td><strong>Description</strong></td>
2270+
* </tr>
2271+
* <tr>
2272+
* <td>chat_id</td>
2273+
* <td>Integer or String</td>
2274+
* <td>Yes</td>
2275+
* <td>Unique identifier for the target chat or username of the target channel (in the format <code>@channelusername</code>)</td>
2276+
* </tr>
2277+
* <tr>
2278+
* <td>description</td>
2279+
* <td>String</td>
2280+
* <td>No</td>
2281+
* <td>New chat description, 0-255 characters</td>
2282+
* </tr>
2283+
* </table>
2284+
* \param $content the request parameters as array
2285+
* \return the JSON Telegram's reply.
2286+
*/
2287+
public function setChatDescription(array $content)
2288+
{
2289+
return $this->endpoint('setChatDescription', $content);
2290+
}
2291+
2292+
// Pin Chat Message
22272293

2294+
/**
2295+
* Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2296+
* <table>
2297+
* <tr>
2298+
* <td><strong>Parameters</strong></td>
2299+
* <td><strong>Type</strong></td>
2300+
* <td><strong>Required</strong></td>
2301+
* <td><strong>Description</strong></td>
2302+
* </tr>
2303+
* <tr>
2304+
* <td>chat_id</td>
2305+
* <td>Integer or String</td>
2306+
* <td>Yes</td>
2307+
* <td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>
2308+
* </tr>
2309+
* <tr>
2310+
* <td>message_id</td>
2311+
* <td>Integer</td>
2312+
* <td>Yes</td>
2313+
* <td>Identifier of a message to pin</td>
2314+
* </tr>
2315+
* <tr>
2316+
* <td>disable_notification</td>
2317+
* <td>Boolean</td>
2318+
* <td>No</td>
2319+
* <td>Pass <em>True</em>, if it is not necessary to send a notification to all group members about the new pinned message</td>
2320+
* </tr>
2321+
* </table>
2322+
* \param $content the request parameters as array
2323+
* \return the JSON Telegram's reply.
2324+
*/
2325+
public function pinChatMessage(array $content)
2326+
{
2327+
return $this->endpoint('pinChatMessage', $content);
2328+
}
2329+
2330+
// Unpin Chat Message
2331+
2332+
/**
2333+
* Use this method to unpin a message in a supergroup chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
2334+
* <table>
2335+
* <tr>
2336+
* <td><strong>Parameters</strong></td>
2337+
* <td><strong>Type</strong></td>
2338+
* <td><strong>Required</strong></td>
2339+
* <td><strong>Description</strong></td>
2340+
* </tr>
2341+
* <tr>
2342+
* <td>chat_id</td>
2343+
* <td>Integer or String</td>
2344+
* <td>Yes</td>
2345+
* <td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>
2346+
* </tr>
2347+
* </table>
2348+
* \param $content the request parameters as array
2349+
* \return the JSON Telegram's reply.
2350+
*/
2351+
public function unpinChatMessage(array $content)
2352+
{
2353+
return $this->endpoint('unpinChatMessage', $content);
2354+
}
2355+
22282356
/// Delete a message
22292357

22302358
/**

0 commit comments

Comments
 (0)