| Total Complexity | 77 |
| Total Lines | 872 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Complex classes like BaseAPI often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BaseAPI, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 20 | trait BaseAPI |
||
| 21 | { |
||
| 22 | |||
| 23 | |||
| 24 | abstract public function sendRequest(string $method, array $args): PromiseInterface; |
||
| 25 | |||
| 26 | |||
| 27 | public function getUpdates( |
||
| 28 | ?int $offset = null, |
||
| 29 | ?int $limit = null, |
||
| 30 | ?int $timeout = null, |
||
| 31 | ?array $allowedUpdates = null |
||
| 32 | ): PromiseInterface { |
||
| 33 | $args = get_defined_vars(); |
||
| 34 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 35 | } |
||
| 36 | |||
| 37 | |||
| 38 | public function setWebhook( |
||
| 39 | string $url, |
||
| 40 | ?InputFile $certificate = null, |
||
| 41 | ?string $ipAddress = null, |
||
| 42 | ?int $maxConnections = null, |
||
| 43 | ?array $allowedUpdates = null, |
||
| 44 | ?bool $dropPendingUpdates = null |
||
| 45 | ): PromiseInterface { |
||
| 46 | $args = get_defined_vars(); |
||
| 47 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 48 | } |
||
| 49 | |||
| 50 | |||
| 51 | public function deleteWebhook(?bool $dropPendingUpdates = null): PromiseInterface |
||
| 52 | { |
||
| 53 | $args = get_defined_vars(); |
||
| 54 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 55 | } |
||
| 56 | |||
| 57 | |||
| 58 | public function getWebhookInfo(): PromiseInterface |
||
| 59 | { |
||
| 60 | $args = get_defined_vars(); |
||
| 61 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 62 | } |
||
| 63 | |||
| 64 | |||
| 65 | public function getMe(): PromiseInterface |
||
| 66 | { |
||
| 67 | $args = get_defined_vars(); |
||
| 68 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 69 | } |
||
| 70 | |||
| 71 | |||
| 72 | public function logOut(): PromiseInterface |
||
| 73 | { |
||
| 74 | $args = get_defined_vars(); |
||
| 75 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 76 | } |
||
| 77 | |||
| 78 | |||
| 79 | public function close(): PromiseInterface |
||
| 80 | { |
||
| 81 | $args = get_defined_vars(); |
||
| 82 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 83 | } |
||
| 84 | |||
| 85 | |||
| 86 | public function sendMessage( |
||
| 87 | int|string $chatId, |
||
| 88 | string $text, |
||
| 89 | ?string $parseMode = null, |
||
| 90 | ?array $entities = null, |
||
| 91 | ?bool $disableWebPagePreview = null, |
||
| 92 | ?bool $disableNotification = null, |
||
| 93 | ?int $replyToMessageId = null, |
||
| 94 | ?bool $allowSendingWithoutReply = null, |
||
| 95 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 96 | ): PromiseInterface { |
||
| 97 | $args = get_defined_vars(); |
||
| 98 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 99 | } |
||
| 100 | |||
| 101 | |||
| 102 | public function forwardMessage( |
||
| 103 | int|string $chatId, |
||
| 104 | int|string $fromChatId, |
||
| 105 | int $messageId, |
||
| 106 | ?bool $disableNotification = null |
||
| 107 | ): PromiseInterface { |
||
| 108 | $args = get_defined_vars(); |
||
| 109 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 110 | } |
||
| 111 | |||
| 112 | |||
| 113 | public function copyMessage( |
||
| 114 | int|string $chatId, |
||
| 115 | int|string $fromChatId, |
||
| 116 | int $messageId, |
||
| 117 | ?string $caption = null, |
||
| 118 | ?string $parseMode = null, |
||
| 119 | ?array $captionEntities = null, |
||
| 120 | ?bool $disableNotification = null, |
||
| 121 | ?int $replyToMessageId = null, |
||
| 122 | ?bool $allowSendingWithoutReply = null, |
||
| 123 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 124 | ): PromiseInterface { |
||
| 125 | $args = get_defined_vars(); |
||
| 126 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 127 | } |
||
| 128 | |||
| 129 | |||
| 130 | public function sendPhoto( |
||
| 131 | int|string $chatId, |
||
| 132 | InputFile|string $photo, |
||
| 133 | ?string $caption = null, |
||
| 134 | ?string $parseMode = null, |
||
| 135 | ?array $captionEntities = null, |
||
| 136 | ?bool $disableNotification = null, |
||
| 137 | ?int $replyToMessageId = null, |
||
| 138 | ?bool $allowSendingWithoutReply = null, |
||
| 139 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 140 | ): PromiseInterface { |
||
| 141 | $args = get_defined_vars(); |
||
| 142 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 143 | } |
||
| 144 | |||
| 145 | |||
| 146 | public function sendAudio( |
||
| 147 | int|string $chatId, |
||
| 148 | InputFile|string $audio, |
||
| 149 | ?string $caption = null, |
||
| 150 | ?string $parseMode = null, |
||
| 151 | ?array $captionEntities = null, |
||
| 152 | ?int $duration = null, |
||
| 153 | ?string $performer = null, |
||
| 154 | ?string $title = null, |
||
| 155 | InputFile|string|null $thumb = null, |
||
| 156 | ?bool $disableNotification = null, |
||
| 157 | ?int $replyToMessageId = null, |
||
| 158 | ?bool $allowSendingWithoutReply = null, |
||
| 159 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 160 | ): PromiseInterface { |
||
| 161 | $args = get_defined_vars(); |
||
| 162 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 163 | } |
||
| 164 | |||
| 165 | |||
| 166 | public function sendDocument( |
||
| 167 | int|string $chatId, |
||
| 168 | InputFile|string $document, |
||
| 169 | InputFile|string|null $thumb = null, |
||
| 170 | ?string $caption = null, |
||
| 171 | ?string $parseMode = null, |
||
| 172 | ?array $captionEntities = null, |
||
| 173 | ?bool $disableContentTypeDetection = null, |
||
| 174 | ?bool $disableNotification = null, |
||
| 175 | ?int $replyToMessageId = null, |
||
| 176 | ?bool $allowSendingWithoutReply = null, |
||
| 177 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 178 | ): PromiseInterface { |
||
| 179 | $args = get_defined_vars(); |
||
| 180 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 181 | } |
||
| 182 | |||
| 183 | |||
| 184 | public function sendVideo( |
||
| 185 | int|string $chatId, |
||
| 186 | InputFile|string $video, |
||
| 187 | ?int $duration = null, |
||
| 188 | ?int $width = null, |
||
| 189 | ?int $height = null, |
||
| 190 | InputFile|string|null $thumb = null, |
||
| 191 | ?string $caption = null, |
||
| 192 | ?string $parseMode = null, |
||
| 193 | ?array $captionEntities = null, |
||
| 194 | ?bool $supportsStreaming = null, |
||
| 195 | ?bool $disableNotification = null, |
||
| 196 | ?int $replyToMessageId = null, |
||
| 197 | ?bool $allowSendingWithoutReply = null, |
||
| 198 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 199 | ): PromiseInterface { |
||
| 200 | $args = get_defined_vars(); |
||
| 201 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 202 | } |
||
| 203 | |||
| 204 | |||
| 205 | public function sendAnimation( |
||
| 206 | int|string $chatId, |
||
| 207 | InputFile|string $animation, |
||
| 208 | ?int $duration = null, |
||
| 209 | ?int $width = null, |
||
| 210 | ?int $height = null, |
||
| 211 | InputFile|string|null $thumb = null, |
||
| 212 | ?string $caption = null, |
||
| 213 | ?string $parseMode = null, |
||
| 214 | ?array $captionEntities = null, |
||
| 215 | ?bool $disableNotification = null, |
||
| 216 | ?int $replyToMessageId = null, |
||
| 217 | ?bool $allowSendingWithoutReply = null, |
||
| 218 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 219 | ): PromiseInterface { |
||
| 220 | $args = get_defined_vars(); |
||
| 221 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 222 | } |
||
| 223 | |||
| 224 | |||
| 225 | public function sendVoice( |
||
| 226 | int|string $chatId, |
||
| 227 | InputFile|string $voice, |
||
| 228 | ?string $caption = null, |
||
| 229 | ?string $parseMode = null, |
||
| 230 | ?array $captionEntities = null, |
||
| 231 | ?int $duration = null, |
||
| 232 | ?bool $disableNotification = null, |
||
| 233 | ?int $replyToMessageId = null, |
||
| 234 | ?bool $allowSendingWithoutReply = null, |
||
| 235 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 236 | ): PromiseInterface { |
||
| 237 | $args = get_defined_vars(); |
||
| 238 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 239 | } |
||
| 240 | |||
| 241 | |||
| 242 | public function sendVideoNote( |
||
| 243 | int|string $chatId, |
||
| 244 | InputFile|string $videoNote, |
||
| 245 | ?int $duration = null, |
||
| 246 | ?int $length = null, |
||
| 247 | InputFile|string|null $thumb = null, |
||
| 248 | ?bool $disableNotification = null, |
||
| 249 | ?int $replyToMessageId = null, |
||
| 250 | ?bool $allowSendingWithoutReply = null, |
||
| 251 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 252 | ): PromiseInterface { |
||
| 253 | $args = get_defined_vars(); |
||
| 254 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 255 | } |
||
| 256 | |||
| 257 | |||
| 258 | public function sendMediaGroup( |
||
| 259 | int|string $chatId, |
||
| 260 | array $media, |
||
| 261 | ?bool $disableNotification = null, |
||
| 262 | ?int $replyToMessageId = null, |
||
| 263 | ?bool $allowSendingWithoutReply = null |
||
| 264 | ): PromiseInterface { |
||
| 265 | $args = get_defined_vars(); |
||
| 266 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 267 | } |
||
| 268 | |||
| 269 | |||
| 270 | public function sendLocation( |
||
| 271 | int|string $chatId, |
||
| 272 | float $latitude, |
||
| 273 | float $longitude, |
||
| 274 | ?float $horizontalAccuracy = null, |
||
| 275 | ?int $livePeriod = null, |
||
| 276 | ?int $heading = null, |
||
| 277 | ?int $proximityAlertRadius = null, |
||
| 278 | ?bool $disableNotification = null, |
||
| 279 | ?int $replyToMessageId = null, |
||
| 280 | ?bool $allowSendingWithoutReply = null, |
||
| 281 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 282 | ): PromiseInterface { |
||
| 283 | $args = get_defined_vars(); |
||
| 284 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 285 | } |
||
| 286 | |||
| 287 | |||
| 288 | public function editMessageLiveLocation( |
||
| 289 | float $latitude, |
||
| 290 | float $longitude, |
||
| 291 | int|string|null $chatId = null, |
||
| 292 | ?int $messageId = null, |
||
| 293 | ?string $inlineMessageId = null, |
||
| 294 | ?float $horizontalAccuracy = null, |
||
| 295 | ?int $heading = null, |
||
| 296 | ?int $proximityAlertRadius = null, |
||
| 297 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 298 | ): PromiseInterface { |
||
| 299 | $args = get_defined_vars(); |
||
| 300 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 301 | } |
||
| 302 | |||
| 303 | |||
| 304 | public function stopMessageLiveLocation( |
||
| 305 | int|string|null $chatId = null, |
||
| 306 | ?int $messageId = null, |
||
| 307 | ?string $inlineMessageId = null, |
||
| 308 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 309 | ): PromiseInterface { |
||
| 310 | $args = get_defined_vars(); |
||
| 311 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 312 | } |
||
| 313 | |||
| 314 | |||
| 315 | public function sendVenue( |
||
| 316 | int|string $chatId, |
||
| 317 | float $latitude, |
||
| 318 | float $longitude, |
||
| 319 | string $title, |
||
| 320 | string $address, |
||
| 321 | ?string $foursquareId = null, |
||
| 322 | ?string $foursquareType = null, |
||
| 323 | ?string $googlePlaceId = null, |
||
| 324 | ?string $googlePlaceType = null, |
||
| 325 | ?bool $disableNotification = null, |
||
| 326 | ?int $replyToMessageId = null, |
||
| 327 | ?bool $allowSendingWithoutReply = null, |
||
| 328 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 329 | ): PromiseInterface { |
||
| 330 | $args = get_defined_vars(); |
||
| 331 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 332 | } |
||
| 333 | |||
| 334 | |||
| 335 | public function sendContact( |
||
| 336 | int|string $chatId, |
||
| 337 | string $phoneNumber, |
||
| 338 | string $firstName, |
||
| 339 | ?string $lastName = null, |
||
| 340 | ?string $vcard = null, |
||
| 341 | ?bool $disableNotification = null, |
||
| 342 | ?int $replyToMessageId = null, |
||
| 343 | ?bool $allowSendingWithoutReply = null, |
||
| 344 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 345 | ): PromiseInterface { |
||
| 346 | $args = get_defined_vars(); |
||
| 347 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 348 | } |
||
| 349 | |||
| 350 | |||
| 351 | public function sendPoll( |
||
| 352 | int|string $chatId, |
||
| 353 | string $question, |
||
| 354 | array $options, |
||
| 355 | ?bool $isAnonymous = null, |
||
| 356 | ?string $type = null, |
||
| 357 | ?bool $allowsMultipleAnswers = null, |
||
| 358 | ?int $correctOptionId = null, |
||
| 359 | ?string $explanation = null, |
||
| 360 | ?string $explanationParseMode = null, |
||
| 361 | ?array $explanationEntities = null, |
||
| 362 | ?int $openPeriod = null, |
||
| 363 | ?int $closeDate = null, |
||
| 364 | ?bool $isClosed = null, |
||
| 365 | ?bool $disableNotification = null, |
||
| 366 | ?int $replyToMessageId = null, |
||
| 367 | ?bool $allowSendingWithoutReply = null, |
||
| 368 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 369 | ): PromiseInterface { |
||
| 370 | $args = get_defined_vars(); |
||
| 371 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 372 | } |
||
| 373 | |||
| 374 | |||
| 375 | public function sendDice( |
||
| 376 | int|string $chatId, |
||
| 377 | ?string $emoji = null, |
||
| 378 | ?bool $disableNotification = null, |
||
| 379 | ?int $replyToMessageId = null, |
||
| 380 | ?bool $allowSendingWithoutReply = null, |
||
| 381 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 382 | ): PromiseInterface { |
||
| 383 | $args = get_defined_vars(); |
||
| 384 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 385 | } |
||
| 386 | |||
| 387 | |||
| 388 | public function sendChatAction(int|string $chatId, string $action): PromiseInterface |
||
| 389 | { |
||
| 390 | $args = get_defined_vars(); |
||
| 391 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 392 | } |
||
| 393 | |||
| 394 | |||
| 395 | public function getUserProfilePhotos(int $userId, ?int $offset = null, ?int $limit = null): PromiseInterface |
||
| 396 | { |
||
| 397 | $args = get_defined_vars(); |
||
| 398 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 399 | } |
||
| 400 | |||
| 401 | |||
| 402 | public function getFile(string $fileId): PromiseInterface |
||
| 403 | { |
||
| 404 | $args = get_defined_vars(); |
||
| 405 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 406 | } |
||
| 407 | |||
| 408 | |||
| 409 | public function kickChatMember( |
||
| 410 | int|string $chatId, |
||
| 411 | int $userId, |
||
| 412 | ?int $untilDate = null, |
||
| 413 | ?bool $revokeMessages = null |
||
| 414 | ): PromiseInterface { |
||
| 415 | $args = get_defined_vars(); |
||
| 416 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 417 | } |
||
| 418 | |||
| 419 | |||
| 420 | public function unbanChatMember(int|string $chatId, int $userId, ?bool $onlyIfBanned = null): PromiseInterface |
||
| 421 | { |
||
| 422 | $args = get_defined_vars(); |
||
| 423 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 424 | } |
||
| 425 | |||
| 426 | |||
| 427 | public function restrictChatMember( |
||
| 428 | int|string $chatId, |
||
| 429 | int $userId, |
||
| 430 | ChatPermissions $permissions, |
||
| 431 | ?int $untilDate = null |
||
| 432 | ): PromiseInterface { |
||
| 433 | $args = get_defined_vars(); |
||
| 434 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 435 | } |
||
| 436 | |||
| 437 | |||
| 438 | public function promoteChatMember( |
||
| 439 | int|string $chatId, |
||
| 440 | int $userId, |
||
| 441 | ?bool $isAnonymous = null, |
||
| 442 | ?bool $canManageChat = null, |
||
| 443 | ?bool $canPostMessages = null, |
||
| 444 | ?bool $canEditMessages = null, |
||
| 445 | ?bool $canDeleteMessages = null, |
||
| 446 | ?bool $canManageVoiceChats = null, |
||
| 447 | ?bool $canRestrictMembers = null, |
||
| 448 | ?bool $canPromoteMembers = null, |
||
| 449 | ?bool $canChangeInfo = null, |
||
| 450 | ?bool $canInviteUsers = null, |
||
| 451 | ?bool $canPinMessages = null |
||
| 452 | ): PromiseInterface { |
||
| 453 | $args = get_defined_vars(); |
||
| 454 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 455 | } |
||
| 456 | |||
| 457 | |||
| 458 | public function setChatAdministratorCustomTitle( |
||
| 459 | int|string $chatId, |
||
| 460 | int $userId, |
||
| 461 | string $customTitle |
||
| 462 | ): PromiseInterface { |
||
| 463 | $args = get_defined_vars(); |
||
| 464 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 465 | } |
||
| 466 | |||
| 467 | |||
| 468 | public function setChatPermissions(int|string $chatId, ChatPermissions $permissions): PromiseInterface |
||
| 469 | { |
||
| 470 | $args = get_defined_vars(); |
||
| 471 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 472 | } |
||
| 473 | |||
| 474 | |||
| 475 | public function exportChatInviteLink(int|string $chatId): PromiseInterface |
||
| 476 | { |
||
| 477 | $args = get_defined_vars(); |
||
| 478 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 479 | } |
||
| 480 | |||
| 481 | |||
| 482 | public function createChatInviteLink( |
||
| 483 | int|string $chatId, |
||
| 484 | ?int $expireDate = null, |
||
| 485 | ?int $memberLimit = null |
||
| 486 | ): PromiseInterface { |
||
| 487 | $args = get_defined_vars(); |
||
| 488 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 489 | } |
||
| 490 | |||
| 491 | |||
| 492 | public function editChatInviteLink( |
||
| 493 | int|string $chatId, |
||
| 494 | string $inviteLink, |
||
| 495 | ?int $expireDate = null, |
||
| 496 | ?int $memberLimit = null |
||
| 497 | ): PromiseInterface { |
||
| 498 | $args = get_defined_vars(); |
||
| 499 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 500 | } |
||
| 501 | |||
| 502 | |||
| 503 | public function revokeChatInviteLink(int|string $chatId, string $inviteLink): PromiseInterface |
||
| 504 | { |
||
| 505 | $args = get_defined_vars(); |
||
| 506 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 507 | } |
||
| 508 | |||
| 509 | |||
| 510 | public function setChatPhoto(int|string $chatId, InputFile $photo): PromiseInterface |
||
| 511 | { |
||
| 512 | $args = get_defined_vars(); |
||
| 513 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 514 | } |
||
| 515 | |||
| 516 | |||
| 517 | public function deleteChatPhoto(int|string $chatId): PromiseInterface |
||
| 518 | { |
||
| 519 | $args = get_defined_vars(); |
||
| 520 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 521 | } |
||
| 522 | |||
| 523 | |||
| 524 | public function setChatTitle(int|string $chatId, string $title): PromiseInterface |
||
| 525 | { |
||
| 526 | $args = get_defined_vars(); |
||
| 527 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 528 | } |
||
| 529 | |||
| 530 | |||
| 531 | public function setChatDescription(int|string $chatId, ?string $description = null): PromiseInterface |
||
| 532 | { |
||
| 533 | $args = get_defined_vars(); |
||
| 534 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 535 | } |
||
| 536 | |||
| 537 | |||
| 538 | public function pinChatMessage( |
||
| 539 | int|string $chatId, |
||
| 540 | int $messageId, |
||
| 541 | ?bool $disableNotification = null |
||
| 542 | ): PromiseInterface { |
||
| 543 | $args = get_defined_vars(); |
||
| 544 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 545 | } |
||
| 546 | |||
| 547 | |||
| 548 | public function unpinChatMessage(int|string $chatId, ?int $messageId = null): PromiseInterface |
||
| 549 | { |
||
| 550 | $args = get_defined_vars(); |
||
| 551 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 552 | } |
||
| 553 | |||
| 554 | |||
| 555 | public function unpinAllChatMessages(int|string $chatId): PromiseInterface |
||
| 556 | { |
||
| 557 | $args = get_defined_vars(); |
||
| 558 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 559 | } |
||
| 560 | |||
| 561 | |||
| 562 | public function leaveChat(int|string $chatId): PromiseInterface |
||
| 563 | { |
||
| 564 | $args = get_defined_vars(); |
||
| 565 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 566 | } |
||
| 567 | |||
| 568 | |||
| 569 | public function getChat(int|string $chatId): PromiseInterface |
||
| 570 | { |
||
| 571 | $args = get_defined_vars(); |
||
| 572 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 573 | } |
||
| 574 | |||
| 575 | |||
| 576 | public function getChatAdministrators(int|string $chatId): PromiseInterface |
||
| 577 | { |
||
| 578 | $args = get_defined_vars(); |
||
| 579 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 580 | } |
||
| 581 | |||
| 582 | |||
| 583 | public function getChatMembersCount(int|string $chatId): PromiseInterface |
||
| 584 | { |
||
| 585 | $args = get_defined_vars(); |
||
| 586 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 587 | } |
||
| 588 | |||
| 589 | |||
| 590 | public function getChatMember(int|string $chatId, int $userId): PromiseInterface |
||
| 591 | { |
||
| 592 | $args = get_defined_vars(); |
||
| 593 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 594 | } |
||
| 595 | |||
| 596 | |||
| 597 | public function setChatStickerSet(int|string $chatId, string $stickerSetName): PromiseInterface |
||
| 598 | { |
||
| 599 | $args = get_defined_vars(); |
||
| 600 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 601 | } |
||
| 602 | |||
| 603 | |||
| 604 | public function deleteChatStickerSet(int|string $chatId): PromiseInterface |
||
| 605 | { |
||
| 606 | $args = get_defined_vars(); |
||
| 607 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 608 | } |
||
| 609 | |||
| 610 | |||
| 611 | public function answerCallbackQuery( |
||
| 612 | string $callbackQueryId, |
||
| 613 | ?string $text = null, |
||
| 614 | ?bool $showAlert = null, |
||
| 615 | ?string $url = null, |
||
| 616 | ?int $cacheTime = null |
||
| 617 | ): PromiseInterface { |
||
| 618 | $args = get_defined_vars(); |
||
| 619 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 620 | } |
||
| 621 | |||
| 622 | |||
| 623 | public function setMyCommands(array $commands): PromiseInterface |
||
| 624 | { |
||
| 625 | $args = get_defined_vars(); |
||
| 626 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 627 | } |
||
| 628 | |||
| 629 | |||
| 630 | public function getMyCommands(): PromiseInterface |
||
| 631 | { |
||
| 632 | $args = get_defined_vars(); |
||
| 633 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 634 | } |
||
| 635 | |||
| 636 | |||
| 637 | public function editMessageText( |
||
| 638 | string $text, |
||
| 639 | int|string|null $chatId = null, |
||
| 640 | ?int $messageId = null, |
||
| 641 | ?string $inlineMessageId = null, |
||
| 642 | ?string $parseMode = null, |
||
| 643 | ?array $entities = null, |
||
| 644 | ?bool $disableWebPagePreview = null, |
||
| 645 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 646 | ): PromiseInterface { |
||
| 647 | $args = get_defined_vars(); |
||
| 648 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 649 | } |
||
| 650 | |||
| 651 | |||
| 652 | public function editMessageCaption( |
||
| 653 | int|string|null $chatId = null, |
||
| 654 | ?int $messageId = null, |
||
| 655 | ?string $inlineMessageId = null, |
||
| 656 | ?string $caption = null, |
||
| 657 | ?string $parseMode = null, |
||
| 658 | ?array $captionEntities = null, |
||
| 659 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 660 | ): PromiseInterface { |
||
| 661 | $args = get_defined_vars(); |
||
| 662 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 663 | } |
||
| 664 | |||
| 665 | |||
| 666 | public function editMessageMedia( |
||
| 667 | InputMedia $media, |
||
| 668 | int|string|null $chatId = null, |
||
| 669 | ?int $messageId = null, |
||
| 670 | ?string $inlineMessageId = null, |
||
| 671 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 672 | ): PromiseInterface { |
||
| 673 | $args = get_defined_vars(); |
||
| 674 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 675 | } |
||
| 676 | |||
| 677 | |||
| 678 | public function editMessageReplyMarkup( |
||
| 679 | int|string|null $chatId = null, |
||
| 680 | ?int $messageId = null, |
||
| 681 | ?string $inlineMessageId = null, |
||
| 682 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 683 | ): PromiseInterface { |
||
| 684 | $args = get_defined_vars(); |
||
| 685 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 686 | } |
||
| 687 | |||
| 688 | |||
| 689 | public function stopPoll( |
||
| 690 | int|string $chatId, |
||
| 691 | int $messageId, |
||
| 692 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 693 | ): PromiseInterface { |
||
| 694 | $args = get_defined_vars(); |
||
| 695 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 696 | } |
||
| 697 | |||
| 698 | |||
| 699 | public function deleteMessage(int|string $chatId, int $messageId): PromiseInterface |
||
| 700 | { |
||
| 701 | $args = get_defined_vars(); |
||
| 702 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 703 | } |
||
| 704 | |||
| 705 | |||
| 706 | public function sendSticker( |
||
| 707 | int|string $chatId, |
||
| 708 | InputFile|string $sticker, |
||
| 709 | ?bool $disableNotification = null, |
||
| 710 | ?int $replyToMessageId = null, |
||
| 711 | ?bool $allowSendingWithoutReply = null, |
||
| 712 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
||
| 713 | ): PromiseInterface { |
||
| 714 | $args = get_defined_vars(); |
||
| 715 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 716 | } |
||
| 717 | |||
| 718 | |||
| 719 | public function getStickerSet(string $name): PromiseInterface |
||
| 720 | { |
||
| 721 | $args = get_defined_vars(); |
||
| 722 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 723 | } |
||
| 724 | |||
| 725 | |||
| 726 | public function uploadStickerFile(int $userId, InputFile $pngSticker): PromiseInterface |
||
| 727 | { |
||
| 728 | $args = get_defined_vars(); |
||
| 729 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 730 | } |
||
| 731 | |||
| 732 | |||
| 733 | public function createNewStickerSet( |
||
| 734 | int $userId, |
||
| 735 | string $name, |
||
| 736 | string $title, |
||
| 737 | string $emojis, |
||
| 738 | InputFile|string|null $pngSticker = null, |
||
| 739 | ?InputFile $tgsSticker = null, |
||
| 740 | ?bool $containsMasks = null, |
||
| 741 | ?MaskPosition $maskPosition = null |
||
| 742 | ): PromiseInterface { |
||
| 743 | $args = get_defined_vars(); |
||
| 744 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 745 | } |
||
| 746 | |||
| 747 | |||
| 748 | public function addStickerToSet( |
||
| 749 | int $userId, |
||
| 750 | string $name, |
||
| 751 | string $emojis, |
||
| 752 | InputFile|string|null $pngSticker = null, |
||
| 753 | ?InputFile $tgsSticker = null, |
||
| 754 | ?MaskPosition $maskPosition = null |
||
| 755 | ): PromiseInterface { |
||
| 756 | $args = get_defined_vars(); |
||
| 757 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 758 | } |
||
| 759 | |||
| 760 | |||
| 761 | public function setStickerPositionInSet(string $sticker, int $position): PromiseInterface |
||
| 762 | { |
||
| 763 | $args = get_defined_vars(); |
||
| 764 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 765 | } |
||
| 766 | |||
| 767 | |||
| 768 | public function deleteStickerFromSet(string $sticker): PromiseInterface |
||
| 769 | { |
||
| 770 | $args = get_defined_vars(); |
||
| 771 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 772 | } |
||
| 773 | |||
| 774 | |||
| 775 | public function setStickerSetThumb(string $name, int $userId, InputFile|string|null $thumb = null): PromiseInterface |
||
| 776 | { |
||
| 777 | $args = get_defined_vars(); |
||
| 778 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 779 | } |
||
| 780 | |||
| 781 | |||
| 782 | public function answerInlineQuery( |
||
| 783 | string $inlineQueryId, |
||
| 784 | array $results, |
||
| 785 | ?int $cacheTime = null, |
||
| 786 | ?bool $isPersonal = null, |
||
| 787 | ?string $nextOffset = null, |
||
| 788 | ?string $switchPmText = null, |
||
| 789 | ?string $switchPmParameter = null |
||
| 790 | ): PromiseInterface { |
||
| 791 | $args = get_defined_vars(); |
||
| 792 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 793 | } |
||
| 794 | |||
| 795 | |||
| 796 | public function sendInvoice( |
||
| 797 | int|string $chatId, |
||
| 798 | string $title, |
||
| 799 | string $description, |
||
| 800 | string $payload, |
||
| 801 | string $providerToken, |
||
| 802 | string $currency, |
||
| 803 | array $prices, |
||
| 804 | ?int $maxTipAmount = null, |
||
| 805 | ?array $suggestedTipAmounts = null, |
||
| 806 | ?string $startParameter = null, |
||
| 807 | ?string $providerData = null, |
||
| 808 | ?string $photoUrl = null, |
||
| 809 | ?int $photoSize = null, |
||
| 810 | ?int $photoWidth = null, |
||
| 811 | ?int $photoHeight = null, |
||
| 812 | ?bool $needName = null, |
||
| 813 | ?bool $needPhoneNumber = null, |
||
| 814 | ?bool $needEmail = null, |
||
| 815 | ?bool $needShippingAddress = null, |
||
| 816 | ?bool $sendPhoneNumberToProvider = null, |
||
| 817 | ?bool $sendEmailToProvider = null, |
||
| 818 | ?bool $isFlexible = null, |
||
| 819 | ?bool $disableNotification = null, |
||
| 820 | ?int $replyToMessageId = null, |
||
| 821 | ?bool $allowSendingWithoutReply = null, |
||
| 822 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 823 | ): PromiseInterface { |
||
| 824 | $args = get_defined_vars(); |
||
| 825 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 826 | } |
||
| 827 | |||
| 828 | |||
| 829 | public function answerShippingQuery( |
||
| 830 | string $shippingQueryId, |
||
| 831 | bool $ok, |
||
| 832 | ?array $shippingOptions = null, |
||
| 833 | ?string $errorMessage = null |
||
| 834 | ): PromiseInterface { |
||
| 835 | $args = get_defined_vars(); |
||
| 836 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 837 | } |
||
| 838 | |||
| 839 | |||
| 840 | public function answerPreCheckoutQuery( |
||
| 841 | string $preCheckoutQueryId, |
||
| 842 | bool $ok, |
||
| 843 | ?string $errorMessage = null |
||
| 844 | ): PromiseInterface { |
||
| 845 | $args = get_defined_vars(); |
||
| 846 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 847 | } |
||
| 848 | |||
| 849 | |||
| 850 | public function setPassportDataErrors(int $userId, array $errors): PromiseInterface |
||
| 851 | { |
||
| 852 | $args = get_defined_vars(); |
||
| 853 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 854 | } |
||
| 855 | |||
| 856 | |||
| 857 | public function sendGame( |
||
| 858 | int $chatId, |
||
| 859 | string $gameShortName, |
||
| 860 | ?bool $disableNotification = null, |
||
| 861 | ?int $replyToMessageId = null, |
||
| 862 | ?bool $allowSendingWithoutReply = null, |
||
| 863 | ?InlineKeyboardMarkup $replyMarkup = null |
||
| 864 | ): PromiseInterface { |
||
| 865 | $args = get_defined_vars(); |
||
| 866 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 867 | } |
||
| 868 | |||
| 869 | |||
| 870 | public function setGameScore( |
||
| 871 | int $userId, |
||
| 872 | int $score, |
||
| 873 | ?bool $force = null, |
||
| 874 | ?bool $disableEditMessage = null, |
||
| 875 | ?int $chatId = null, |
||
| 876 | ?int $messageId = null, |
||
| 877 | ?string $inlineMessageId = null |
||
| 878 | ): PromiseInterface { |
||
| 879 | $args = get_defined_vars(); |
||
| 880 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 881 | } |
||
| 882 | |||
| 883 | |||
| 884 | public function getGameHighScores( |
||
| 885 | int $userId, |
||
| 886 | ?int $chatId = null, |
||
| 887 | ?int $messageId = null, |
||
| 888 | ?string $inlineMessageId = null |
||
| 889 | ): PromiseInterface { |
||
| 890 | $args = get_defined_vars(); |
||
| 891 | return $this->sendRequest(__FUNCTION__, $args); |
||
| 892 | } |
||
| 894 |