@@ -36,10 +36,10 @@ |
||
36 | 36 | * Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events |
37 | 37 | * only. |
38 | 38 | */ |
39 | - public null|chatInviteLink $invite_link = null; |
|
39 | + public null | chatInviteLink $invite_link = null; |
|
40 | 40 | |
41 | 41 | |
42 | - public function __construct(stdClass|null $object = null) { |
|
42 | + public function __construct(stdClass | null $object = null) { |
|
43 | 43 | if ($object != null) { |
44 | 44 | parent::__construct($object, self::subs); |
45 | 45 | } |
@@ -480,95 +480,95 @@ discard block |
||
480 | 480 | ]; |
481 | 481 | |
482 | 482 | private const METHODS_KEYS = [ |
483 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','forgot','answer'], |
|
484 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','forgot','answer'], |
|
485 | - 'deleteWebhook' => ['drop_pending_updates','token','forgot','answer'], |
|
486 | - 'getWebhookInfo' => ['token','forgot','answer'], |
|
487 | - 'getMe' => ['token','forgot','answer'], |
|
488 | - 'logOut' => ['token','forgot','answer'], |
|
489 | - 'close' => ['token','forgot','answer'], |
|
490 | - 'sendMessage' => ['text','chat_id','parse_mode','entities','disable_web_page_preview','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
491 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','forgot','answer'], |
|
492 | - 'copyMessage' => ['chat_id','from_chat_id','message_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
493 | - 'sendPhoto' => ['photo','chat_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
494 | - 'sendAudio' => ['audio','chat_id','caption','parse_mode','caption_entities','duration','performer','title','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
495 | - 'sendDocument' => ['document','chat_id','thumb','caption','parse_mode','caption_entities','disable_content_type_detection','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
496 | - 'sendVideo' => ['video','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','supports_streaming','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
497 | - 'sendAnimation' => ['animation','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
498 | - 'sendVoice' => ['voice','chat_id','caption','parse_mode','caption_entities','duration','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
499 | - 'sendVideoNote' => ['video_note','chat_id','duration','length','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
500 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','forgot','answer'], |
|
501 | - 'sendLocation' => ['latitude','longitude','chat_id','horizontal_accuracy','live_period','heading','proximity_alert_radius','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
502 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','forgot','answer'], |
|
503 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
504 | - 'sendVenue' => ['chat_id','latitude','longitude','title','address','foursquare_id','foursquare_type','google_place_id','google_place_type','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
505 | - 'sendContact' => ['phone_number','first_name','chat_id','last_name','vcard','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
506 | - 'sendPoll' => ['question','options','chat_id','is_anonymous','type','allows_multiple_answers','correct_option_id','explanation','explanation_parse_mode','explanation_entities','open_period','close_date','is_closed','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
507 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
508 | - 'sendChatAction' => ['chat_id','action','token','forgot','answer'], |
|
509 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','forgot','answer'], |
|
510 | - 'getFile' => ['file_id','token','forgot','answer'], |
|
511 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','forgot','answer'], |
|
512 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','forgot','answer'], |
|
513 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','forgot','answer'], |
|
514 | - 'promoteChatMember' => ['chat_id','user_id','is_anonymous','can_manage_chat','can_post_messages','can_edit_messages','can_delete_messages','can_manage_video_chats','can_restrict_members','can_promote_members','can_change_info','can_invite_users','can_pin_messages','token','forgot','answer'], |
|
515 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','forgot','answer'], |
|
516 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','forgot','answer'], |
|
517 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','forgot','answer'], |
|
518 | - 'setChatPermissions' => ['permissions','chat_id','token','forgot','answer'], |
|
519 | - 'exportChatInviteLink' => ['chat_id','token','forgot','answer'], |
|
520 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','forgot','answer'], |
|
521 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','forgot','answer'], |
|
522 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','forgot','answer'], |
|
523 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','forgot','answer'], |
|
524 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','forgot','answer'], |
|
525 | - 'setChatPhoto' => ['photo','chat_id','token','forgot','answer'], |
|
526 | - 'deleteChatPhoto' => ['chat_id','token','forgot','answer'], |
|
527 | - 'setChatTitle' => ['title','chat_id','token','forgot','answer'], |
|
528 | - 'setChatDescription' => ['chat_id','description','token','forgot','answer'], |
|
529 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','forgot','answer'], |
|
530 | - 'unpinChatMessage' => ['chat_id','message_id','token','forgot','answer'], |
|
531 | - 'unpinAllChatMessages' => ['chat_id','token','forgot','answer'], |
|
532 | - 'leaveChat' => ['chat_id','token','forgot','answer'], |
|
533 | - 'getChat' => ['chat_id','token','forgot','answer'], |
|
534 | - 'getChatAdministrators' => ['chat_id','token','forgot','answer'], |
|
535 | - 'getChatMemberCount' => ['chat_id','token','forgot','answer'], |
|
536 | - 'getChatMember' => ['chat_id','user_id','token','forgot','answer'], |
|
537 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','forgot','answer'], |
|
538 | - 'deleteChatStickerSet' => ['chat_id','token','forgot','answer'], |
|
539 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','forgot','answer'], |
|
540 | - 'setMyCommands' => ['commands','scope','language_code','token','forgot','answer'], |
|
541 | - 'deleteMyCommands' => ['scope','language_code','token','forgot','answer'], |
|
542 | - 'getMyCommands' => ['scope','language_code','token','forgot','answer'], |
|
543 | - 'setChatMenuButton' => ['chat_id','menu_button','token','forgot','answer'], |
|
544 | - 'getChatMenuButton' => ['chat_id','token','forgot','answer'], |
|
545 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','forgot','answer'], |
|
546 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','forgot','answer'], |
|
547 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','forgot','answer'], |
|
548 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','forgot','answer'], |
|
549 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
550 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
551 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','forgot','answer'], |
|
552 | - 'deleteMessage' => ['chat_id','message_id','token','forgot','answer'], |
|
553 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
554 | - 'getStickerSet' => ['name','token','forgot','answer'], |
|
483 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'forgot', 'answer'], |
|
484 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'forgot', 'answer'], |
|
485 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'forgot', 'answer'], |
|
486 | + 'getWebhookInfo' => ['token', 'forgot', 'answer'], |
|
487 | + 'getMe' => ['token', 'forgot', 'answer'], |
|
488 | + 'logOut' => ['token', 'forgot', 'answer'], |
|
489 | + 'close' => ['token', 'forgot', 'answer'], |
|
490 | + 'sendMessage' => ['text', 'chat_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
491 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'forgot', 'answer'], |
|
492 | + 'copyMessage' => ['chat_id', 'from_chat_id', 'message_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
493 | + 'sendPhoto' => ['photo', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
494 | + 'sendAudio' => ['audio', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'performer', 'title', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
495 | + 'sendDocument' => ['document', 'chat_id', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_content_type_detection', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
496 | + 'sendVideo' => ['video', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'supports_streaming', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
497 | + 'sendAnimation' => ['animation', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
498 | + 'sendVoice' => ['voice', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
499 | + 'sendVideoNote' => ['video_note', 'chat_id', 'duration', 'length', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
500 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'forgot', 'answer'], |
|
501 | + 'sendLocation' => ['latitude', 'longitude', 'chat_id', 'horizontal_accuracy', 'live_period', 'heading', 'proximity_alert_radius', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
502 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'forgot', 'answer'], |
|
503 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
504 | + 'sendVenue' => ['chat_id', 'latitude', 'longitude', 'title', 'address', 'foursquare_id', 'foursquare_type', 'google_place_id', 'google_place_type', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
505 | + 'sendContact' => ['phone_number', 'first_name', 'chat_id', 'last_name', 'vcard', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
506 | + 'sendPoll' => ['question', 'options', 'chat_id', 'is_anonymous', 'type', 'allows_multiple_answers', 'correct_option_id', 'explanation', 'explanation_parse_mode', 'explanation_entities', 'open_period', 'close_date', 'is_closed', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
507 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
508 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'forgot', 'answer'], |
|
509 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'forgot', 'answer'], |
|
510 | + 'getFile' => ['file_id', 'token', 'forgot', 'answer'], |
|
511 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'forgot', 'answer'], |
|
512 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'forgot', 'answer'], |
|
513 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'forgot', 'answer'], |
|
514 | + 'promoteChatMember' => ['chat_id', 'user_id', 'is_anonymous', 'can_manage_chat', 'can_post_messages', 'can_edit_messages', 'can_delete_messages', 'can_manage_video_chats', 'can_restrict_members', 'can_promote_members', 'can_change_info', 'can_invite_users', 'can_pin_messages', 'token', 'forgot', 'answer'], |
|
515 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
516 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'forgot', 'answer'], |
|
517 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'forgot', 'answer'], |
|
518 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'forgot', 'answer'], |
|
519 | + 'exportChatInviteLink' => ['chat_id', 'token', 'forgot', 'answer'], |
|
520 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'forgot', 'answer'], |
|
521 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'forgot', 'answer'], |
|
522 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'forgot', 'answer'], |
|
523 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
524 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
525 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'forgot', 'answer'], |
|
526 | + 'deleteChatPhoto' => ['chat_id', 'token', 'forgot', 'answer'], |
|
527 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'forgot', 'answer'], |
|
528 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'forgot', 'answer'], |
|
529 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'forgot', 'answer'], |
|
530 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'forgot', 'answer'], |
|
531 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'forgot', 'answer'], |
|
532 | + 'leaveChat' => ['chat_id', 'token', 'forgot', 'answer'], |
|
533 | + 'getChat' => ['chat_id', 'token', 'forgot', 'answer'], |
|
534 | + 'getChatAdministrators' => ['chat_id', 'token', 'forgot', 'answer'], |
|
535 | + 'getChatMemberCount' => ['chat_id', 'token', 'forgot', 'answer'], |
|
536 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
537 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'forgot', 'answer'], |
|
538 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'forgot', 'answer'], |
|
539 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'forgot', 'answer'], |
|
540 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'forgot', 'answer'], |
|
541 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'forgot', 'answer'], |
|
542 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'forgot', 'answer'], |
|
543 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'forgot', 'answer'], |
|
544 | + 'getChatMenuButton' => ['chat_id', 'token', 'forgot', 'answer'], |
|
545 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'forgot', 'answer'], |
|
546 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'forgot', 'answer'], |
|
547 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'forgot', 'answer'], |
|
548 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'forgot', 'answer'], |
|
549 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
550 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
551 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
552 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'forgot', 'answer'], |
|
553 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
554 | + 'getStickerSet' => ['name', 'token', 'forgot', 'answer'], |
|
555 | 555 | 'getCustomEmojiStickers' => ['custom_emoji_ids', 'token', 'return_array', 'forgot', 'answer'], |
556 | - 'uploadStickerFile' => ['png_sticker','user_id','token','forgot','answer'], |
|
557 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','sticker_type','contains_masks','mask_position','token','forgot','answer'], |
|
558 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','forgot','answer'], |
|
559 | - 'setStickerPositionInSet' => ['sticker','position','token','forgot','answer'], |
|
560 | - 'deleteStickerFromSet' => ['sticker','token','forgot','answer'], |
|
561 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','forgot','answer'], |
|
562 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','forgot','answer'], |
|
563 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','forgot','answer'], |
|
564 | - 'sendInvoice' => ['title','description','payload','provider_token','currency','prices','chat_id','max_tip_amount','suggested_tip_amounts','start_parameter','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
565 | - 'createInvoiceLink' => ['title','description','payload','provider_token','currency','prices','max_tip_amount','suggested_tip_amounts','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','token','forgot','answer'], |
|
566 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','forgot','answer'], |
|
567 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','forgot','answer'], |
|
568 | - 'setPassportDataErrors' => ['errors','user_id','token','forgot','answer'], |
|
569 | - 'sendGame' => ['game_short_name','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
570 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','forgot','answer'], |
|
571 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','forgot','answer'], |
|
556 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'forgot', 'answer'], |
|
557 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'sticker_type', 'contains_masks', 'mask_position', 'token', 'forgot', 'answer'], |
|
558 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'forgot', 'answer'], |
|
559 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'forgot', 'answer'], |
|
560 | + 'deleteStickerFromSet' => ['sticker', 'token', 'forgot', 'answer'], |
|
561 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'forgot', 'answer'], |
|
562 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'forgot', 'answer'], |
|
563 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'forgot', 'answer'], |
|
564 | + 'sendInvoice' => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'chat_id', 'max_tip_amount', 'suggested_tip_amounts', 'start_parameter', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
565 | + 'createInvoiceLink' => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'max_tip_amount', 'suggested_tip_amounts', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'token', 'forgot', 'answer'], |
|
566 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'forgot', 'answer'], |
|
567 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'forgot', 'answer'], |
|
568 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'forgot', 'answer'], |
|
569 | + 'sendGame' => ['game_short_name', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
570 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'forgot', 'answer'], |
|
571 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'forgot', 'answer'], |
|
572 | 572 | 'getForumTopicIconStickers' => ['token', 'return_array', 'forgot', 'answer'], |
573 | 573 | 'createForumTopic' => ['chat_id', 'name', 'icon_color', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
574 | 574 | 'editForumTopic' => ['chat_id', 'message_thread_id', 'name', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
@@ -604,8 +604,8 @@ discard block |
||
604 | 604 | 'logOut' => [], |
605 | 605 | 'close' => [], |
606 | 606 | 'sendMessage' => ['chat_id'], |
607 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
608 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
607 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
608 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
609 | 609 | 'sendPhoto' => ['chat_id'], |
610 | 610 | 'sendAudio' => ['chat_id'], |
611 | 611 | 'sendDocument' => ['chat_id'], |
@@ -621,15 +621,15 @@ discard block |
||
621 | 621 | 'sendContact' => ['chat_id'], |
622 | 622 | 'sendPoll' => ['chat_id'], |
623 | 623 | 'sendDice' => ['chat_id'], |
624 | - 'sendChatAction' => ['chat_id','action'], |
|
624 | + 'sendChatAction' => ['chat_id', 'action'], |
|
625 | 625 | 'getUserProfilePhotos' => ['user_id'], |
626 | 626 | 'getFile' => ['file_id'], |
627 | - 'banChatMember' => ['chat_id','user_id'], |
|
628 | - 'kickChatMember' => ['chat_id','user_id'], |
|
629 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
630 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
631 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
632 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
627 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
628 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
629 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
630 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
631 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
632 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
633 | 633 | 'banChatSenderChat' => ['chat_id'], |
634 | 634 | 'unbanChatSenderChat' => ['chat_id'], |
635 | 635 | 'setChatPermissions' => ['chat_id'], |
@@ -637,8 +637,8 @@ discard block |
||
637 | 637 | 'createChatInviteLink' => ['chat_id'], |
638 | 638 | 'editChatInviteLink' => ['chat_id'], |
639 | 639 | 'revokeChatInviteLink' => ['chat_id'], |
640 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
641 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
640 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
641 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
642 | 642 | 'setChatPhoto' => ['chat_id'], |
643 | 643 | 'deleteChatPhoto' => ['chat_id'], |
644 | 644 | 'setChatTitle' => ['chat_id'], |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | 'getChat' => ['chat_id'], |
651 | 651 | 'getChatAdministrators' => ['chat_id'], |
652 | 652 | 'getChatMembersCount' => ['chat_id'], |
653 | - 'getChatMember' => ['chat_id','user_id'], |
|
653 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
654 | 654 | 'setChatStickerSet' => ['chat_id'], |
655 | 655 | 'deleteChatStickerSet' => ['chat_id'], |
656 | 656 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -661,12 +661,12 @@ discard block |
||
661 | 661 | 'getChatMenuButton' => [], |
662 | 662 | 'setMyDefaultAdministratorRights' => [], |
663 | 663 | 'getMyDefaultAdministratorRights' => [], |
664 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
665 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
666 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
667 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
668 | - 'stopPoll' => ['chat_id','message_id'], |
|
669 | - 'deleteMessage' => ['chat_id','message_id'], |
|
664 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
665 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
666 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
667 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
668 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
669 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
670 | 670 | 'sendSticker' => ['chat_id'], |
671 | 671 | 'getStickerSet' => [], |
672 | 672 | 'uploadStickerFile' => ['user_id'], |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
683 | 683 | 'setPassportDataErrors' => ['user_id'], |
684 | 684 | 'sendGame' => ['chat_id'], |
685 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
686 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
685 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
686 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
687 | 687 | ]; |
688 | 688 | |
689 | 689 | private const METHODS_RETURN = [ |
@@ -737,25 +737,25 @@ discard block |
||
737 | 737 | 'getGameHighScores' => ['BPT\types\gameHighScore'] |
738 | 738 | ]; |
739 | 739 | |
740 | - public static function __callStatic (string $name, array $arguments) { |
|
740 | + public static function __callStatic(string $name, array $arguments) { |
|
741 | 741 | if ($action = self::methodAction($name)) { |
742 | 742 | self::checkArguments($arguments); |
743 | - self::keysName($action,$arguments); |
|
744 | - self::readyFile($action,$arguments); |
|
745 | - self::setDefaults($action,$arguments); |
|
743 | + self::keysName($action, $arguments); |
|
744 | + self::readyFile($action, $arguments); |
|
745 | + self::setDefaults($action, $arguments); |
|
746 | 746 | if (isset($arguments['answer'])) { |
747 | - return answer::init($action,$arguments); |
|
747 | + return answer::init($action, $arguments); |
|
748 | 748 | } |
749 | 749 | else { |
750 | - $result = curl::init($action,$arguments); |
|
750 | + $result = curl::init($action, $arguments); |
|
751 | 751 | if (is_object($result)) { |
752 | - return self::processResponse($action,$result); |
|
752 | + return self::processResponse($action, $result); |
|
753 | 753 | } |
754 | 754 | return false; |
755 | 755 | } |
756 | 756 | } |
757 | 757 | else { |
758 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
758 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
759 | 759 | throw new bptException('METHOD_NOT_FOUND'); |
760 | 760 | } |
761 | 761 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | - private static function keysName (string $name, array &$arguments): void { |
|
769 | + private static function keysName(string $name, array &$arguments): void { |
|
770 | 770 | foreach ($arguments as $key => $argument) { |
771 | 771 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
772 | 772 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
778 | - private static function methodAction(string $name): string|false { |
|
778 | + private static function methodAction(string $name): string | false { |
|
779 | 779 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
780 | 780 | } |
781 | 781 | |
@@ -796,11 +796,11 @@ discard block |
||
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
799 | - private static function methodFile(string $name): array|false { |
|
799 | + private static function methodFile(string $name): array | false { |
|
800 | 800 | return self::METHODS_WITH_FILE[$name] ?? false; |
801 | 801 | } |
802 | 802 | |
803 | - private static function methodReturn(string $name,stdClass $response) { |
|
803 | + private static function methodReturn(string $name, stdClass $response) { |
|
804 | 804 | if (isset(self::METHODS_RETURN[$name])) { |
805 | 805 | $return = self::METHODS_RETURN[$name]; |
806 | 806 | if (is_array($return)) { |
@@ -823,13 +823,13 @@ discard block |
||
823 | 823 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
824 | 824 | foreach ($defaults as $key => $default) { |
825 | 825 | if (is_numeric($key)) { |
826 | - if (!isset($arguments[$default])){ |
|
826 | + if (!isset($arguments[$default])) { |
|
827 | 827 | $arguments[$default] = self::catchFields($default); |
828 | 828 | } |
829 | 829 | } |
830 | 830 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
831 | 831 | foreach ($default as $def) { |
832 | - if (!isset($arguments[$def])){ |
|
832 | + if (!isset($arguments[$def])) { |
|
833 | 833 | $arguments[$def] = self::catchFields($def); |
834 | 834 | } |
835 | 835 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | if ($response->ok) { |
843 | 843 | self::$status = true; |
844 | 844 | self::$pure_response = $response; |
845 | - return self::methodReturn($name,$response); |
|
845 | + return self::methodReturn($name, $response); |
|
846 | 846 | } |
847 | 847 | else { |
848 | 848 | self::$status = false; |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | * |
859 | 859 | * @return int|string|bool |
860 | 860 | */ |
861 | - public static function catchFields (string $field): int|string|bool { |
|
861 | + public static function catchFields(string $field): int | string | bool { |
|
862 | 862 | switch ($field) { |
863 | 863 | case fields::CHAT_ID : |
864 | 864 | case fields::FROM_CHAT_ID : |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | default => false |
995 | 995 | }; |
996 | 996 | case fields::URL : |
997 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
997 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
998 | 998 | default: |
999 | 999 | return false; |
1000 | 1000 | } |
@@ -709,16 +709,14 @@ discard block |
||
709 | 709 | self::setDefaults($action,$arguments); |
710 | 710 | if (isset($arguments['answer'])) { |
711 | 711 | return answer::init($action,$arguments); |
712 | - } |
|
713 | - else { |
|
712 | + } else { |
|
714 | 713 | $result = curl::init($action,$arguments); |
715 | 714 | if (is_object($result)) { |
716 | 715 | return self::processResponse($action,$result); |
717 | 716 | } |
718 | 717 | return false; |
719 | 718 | } |
720 | - } |
|
721 | - else { |
|
719 | + } else { |
|
722 | 720 | logger::write("$name method is not supported",loggerTypes::ERROR); |
723 | 721 | throw new bptException('METHOD_NOT_FOUND'); |
724 | 722 | } |
@@ -744,8 +742,7 @@ discard block |
||
744 | 742 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
745 | 743 | } |
746 | 744 | } |
747 | - } |
|
748 | - elseif ($file_params = self::methodFile($name)) { |
|
745 | + } elseif ($file_params = self::methodFile($name)) { |
|
749 | 746 | foreach ($file_params as $param) { |
750 | 747 | if (isset($arguments[$param]) && file_exists($arguments[$param])) { |
751 | 748 | $arguments[$param] = new CURLFile($arguments[$param]); |
@@ -767,12 +764,10 @@ discard block |
||
767 | 764 | $value = new ($return[0]) ($value); |
768 | 765 | } |
769 | 766 | return $response; |
770 | - } |
|
771 | - else { |
|
767 | + } else { |
|
772 | 768 | return new ($return) ($response->result); |
773 | 769 | } |
774 | - } |
|
775 | - else { |
|
770 | + } else { |
|
776 | 771 | return $response->result; |
777 | 772 | } |
778 | 773 | } |
@@ -784,8 +779,7 @@ discard block |
||
784 | 779 | if (!isset($arguments[$default])){ |
785 | 780 | $arguments[$default] = self::catchFields($default); |
786 | 781 | } |
787 | - } |
|
788 | - elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
782 | + } elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
789 | 783 | foreach ($default as $def) { |
790 | 784 | if (!isset($arguments[$def])){ |
791 | 785 | $arguments[$def] = self::catchFields($def); |
@@ -801,8 +795,7 @@ discard block |
||
801 | 795 | self::$status = true; |
802 | 796 | self::$pure_response = $response; |
803 | 797 | return self::methodReturn($name,$response); |
804 | - } |
|
805 | - else { |
|
798 | + } else { |
|
806 | 799 | self::$status = false; |
807 | 800 | self::$pure_response = $response; |
808 | 801 | return new responseError($response); |
@@ -845,9 +838,13 @@ discard block |
||
845 | 838 | default => false |
846 | 839 | }; |
847 | 840 | case fields::FILE_ID : |
848 | - if (isset(BPT::$update->message)) $type = 'message'; |
|
849 | - elseif (isset(BPT::$update->edited_message)) $type = 'edited_message'; |
|
850 | - else return false; |
|
841 | + if (isset(BPT::$update->message)) { |
|
842 | + $type = 'message'; |
|
843 | + } elseif (isset(BPT::$update->edited_message)) { |
|
844 | + $type = 'edited_message'; |
|
845 | + } else { |
|
846 | + return false; |
|
847 | + } |
|
851 | 848 | |
852 | 849 | return match(true) { |
853 | 850 | isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id, |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | * @method bool|responseError unpinallforumtopicmessages (int|string|array $chat_id, int $message_thread_id, string|null $token = null, bool|null $forgot = null, bool|null $answer = null) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. |
257 | 257 | * @method bool|responseError unpintopicmessages (int|string|array $chat_id, int $message_thread_id, string|null $token = null, bool|null $forgot = null, bool|null $answer = null) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. |
258 | 258 | */ |
259 | -class BPT extends telegram{ |
|
259 | +class BPT extends telegram { |
|
260 | 260 | public static update $update; |
261 | 261 | |
262 | 262 | public static BPT $handler; |
263 | 263 | |
264 | 264 | |
265 | - public function __construct (array|stdClass $settings) { |
|
265 | + public function __construct(array | stdClass $settings) { |
|
266 | 266 | static::$handler = &$this; |
267 | 267 | settings::init($settings); |
268 | 268 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | settings::done(); |
272 | 272 | } |
273 | 273 | |
274 | - public static function exit (string|null $message = null) { |
|
274 | + public static function exit (string | null $message = null) { |
|
275 | 275 | die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>"); |
276 | 276 | } |
277 | 277 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @internal Only for BPT self usage , Don't use it in your source! |
27 | 27 | */ |
28 | - public static function init (): void { |
|
28 | + public static function init(): void { |
|
29 | 29 | $host = settings::$db['host'] ?? 'localhost'; |
30 | 30 | $port = settings::$db['port'] ?? 3306; |
31 | 31 | $user = settings::$db['user'] ?? settings::$db['username'] ?? 'unknown'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $dbname = settings::$db['dbname']; |
34 | 34 | self::$connection = new mysqli($host, $user, $pass, $dbname, $port); |
35 | 35 | if (self::$connection->connect_errno) { |
36 | - logger::write('SQL connection has problem : ' . self::$connection->connect_error, loggerTypes::ERROR); |
|
36 | + logger::write('SQL connection has problem : '.self::$connection->connect_error, loggerTypes::ERROR); |
|
37 | 37 | throw new bptException('SQL_CONNECTION_PROBLEM'); |
38 | 38 | } |
39 | 39 | if (!lock::exist('BPT-MYSQL')) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - private static function install (): void { |
|
44 | + private static function install(): void { |
|
45 | 45 | self::pureQuery(" |
46 | 46 | CREATE TABLE `users` |
47 | 47 | ( |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @internal Only for BPT self usage , Don't use it in your source! |
64 | 64 | */ |
65 | - public static function process (): void { |
|
65 | + public static function process(): void { |
|
66 | 66 | if (isset(BPT::$update->message)) { |
67 | 67 | self::processMessage(BPT::$update->message); |
68 | 68 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - private static function processMessage (message $update): void { |
|
83 | + private static function processMessage(message $update): void { |
|
84 | 84 | $type = $update->chat->type; |
85 | 85 | if ($type === chatType::PRIVATE) { |
86 | 86 | $user_id = $update->from->id; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - private static function processCallbackQuery (callbackQuery $update): void { |
|
109 | + private static function processCallbackQuery(callbackQuery $update): void { |
|
110 | 110 | $type = $update->message->chat->type; |
111 | 111 | if ($type === chatType::PRIVATE) { |
112 | 112 | $user_id = $update->from->id; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - private static function processInlineQuery (inlineQuery $update): void { |
|
119 | + private static function processInlineQuery(inlineQuery $update): void { |
|
120 | 120 | $type = $update->chat_type; |
121 | 121 | if ($type === chatType::PRIVATE || $type === chatType::SENDER) { |
122 | 122 | $user_id = $update->from->id; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - private static function processMyChatMember (chatMemberUpdated $update): void { |
|
129 | + private static function processMyChatMember(chatMemberUpdated $update): void { |
|
130 | 130 | $type = $update->chat->type; |
131 | 131 | if ($type === chatType::PRIVATE) { |
132 | 132 | if ($update->new_chat_member->status === chatMemberStatus::MEMBER) { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return mysqli |
145 | 145 | */ |
146 | - public static function getMysqli (): mysqli { |
|
146 | + public static function getMysqli(): mysqli { |
|
147 | 147 | return self::$connection; |
148 | 148 | } |
149 | 149 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return int|string |
154 | 154 | */ |
155 | - public static function affected_rows (): int|string { |
|
155 | + public static function affected_rows(): int | string { |
|
156 | 156 | return self::$connection->affected_rows; |
157 | 157 | } |
158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return int|string |
163 | 163 | */ |
164 | - public static function insert_id (): int|string { |
|
164 | + public static function insert_id(): int | string { |
|
165 | 165 | return self::$connection->insert_id; |
166 | 166 | } |
167 | 167 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public static function escapeString (string $text): string { |
|
175 | + public static function escapeString(string $text): string { |
|
176 | 176 | return self::$connection->real_escape_string($text); |
177 | 177 | } |
178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return mysqli_result|bool |
189 | 189 | */ |
190 | - public static function pureQuery (string $query): mysqli_result|bool { |
|
190 | + public static function pureQuery(string $query): mysqli_result | bool { |
|
191 | 191 | return self::$connection->query($query); |
192 | 192 | } |
193 | 193 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return mysqli_result|bool |
206 | 206 | */ |
207 | - public static function query (string $query, array $vars = [], bool $need_result = true): mysqli_result|bool { |
|
207 | + public static function query(string $query, array $vars = [], bool $need_result = true): mysqli_result | bool { |
|
208 | 208 | $prepare = self::$connection->prepare($query); |
209 | 209 | if ($prepare->execute($vars)) { |
210 | 210 | return $need_result ? $prepare->get_result() : true; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - private static function makeArrayReady (string &$query, array $array, string $operator = ' AND '): array { |
|
218 | + private static function makeArrayReady(string &$query, array $array, string $operator = ' AND '): array { |
|
219 | 219 | $first = true; |
220 | 220 | $values = []; |
221 | 221 | foreach ($array as $name => $value) { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | return $values; |
232 | 232 | } |
233 | 233 | |
234 | - private static function makeQueryReady (string &$query, array $where = null, int $count = null, int $offset = null): array { |
|
234 | + private static function makeQueryReady(string &$query, array $where = null, int $count = null, int $offset = null): array { |
|
235 | 235 | $values = []; |
236 | 236 | if (!empty($where)) { |
237 | 237 | $query .= " WHERE"; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return mysqli_result|bool |
260 | 260 | */ |
261 | - public static function delete (string $table, array $where = null, int $count = null, int $offset = null): mysqli_result|bool { |
|
261 | + public static function delete(string $table, array $where = null, int $count = null, int $offset = null): mysqli_result | bool { |
|
262 | 262 | $query = "DELETE FROM `$table`"; |
263 | 263 | $res = self::makeQueryReady($query, $where, $count, $offset); |
264 | 264 | return self::query($query, $res, false); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return mysqli_result|bool |
279 | 279 | */ |
280 | - public static function update (string $table, array $modify, array $where = null, int $count = null, int $offset = null): mysqli_result|bool { |
|
280 | + public static function update(string $table, array $modify, array $where = null, int $count = null, int $offset = null): mysqli_result | bool { |
|
281 | 281 | $query = "UPDATE `$table` SET"; |
282 | 282 | $values = self::makeArrayReady($query, $modify, ', '); |
283 | 283 | $res = self::makeQueryReady($query, $where, $count, $offset); |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return mysqli_result|bool |
297 | 297 | */ |
298 | - public static function insert (string $table, string|array $columns, array|string $values): mysqli_result|bool { |
|
298 | + public static function insert(string $table, string | array $columns, array | string $values): mysqli_result | bool { |
|
299 | 299 | $query = "INSERT INTO `$table`("; |
300 | - $query .= '`' . (is_string($columns) ? $columns : implode('`,`', $columns)) . '`) VALUES ('; |
|
300 | + $query .= '`'.(is_string($columns) ? $columns : implode('`,`', $columns)).'`) VALUES ('; |
|
301 | 301 | if (is_string($values)) $values = [$values]; |
302 | - $query .= '?' . str_repeat(',?', count($values) - 1) . ')'; |
|
302 | + $query .= '?'.str_repeat(',?', count($values) - 1).')'; |
|
303 | 303 | return self::query($query, $values, false); |
304 | 304 | } |
305 | 305 | |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return mysqli_result|bool |
319 | 319 | */ |
320 | - public static function select (string $table, array|string $columns = '*', array $where = null, int $count = null, int $offset = null): mysqli_result|bool { |
|
320 | + public static function select(string $table, array | string $columns = '*', array $where = null, int $count = null, int $offset = null): mysqli_result | bool { |
|
321 | 321 | $query = "SELECT "; |
322 | 322 | if ($columns == '*') { |
323 | 323 | $query .= "* "; |
324 | 324 | } |
325 | 325 | else { |
326 | - $query .= '`' . (is_string($columns) ? $columns : implode('`,`', $columns)) . '` '; |
|
326 | + $query .= '`'.(is_string($columns) ? $columns : implode('`,`', $columns)).'` '; |
|
327 | 327 | } |
328 | 328 | $query .= "FROM `$table`"; |
329 | 329 | $res = self::makeQueryReady($query, $where, $count, $offset); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @return null|bool|array |
343 | 343 | */ |
344 | - public static function selectArray (string $table, array|string $columns = '*', array $where = null): bool|array|null { |
|
344 | + public static function selectArray(string $table, array | string $columns = '*', array $where = null): bool | array | null { |
|
345 | 345 | $res = self::select($table, $columns, $where, 1); |
346 | 346 | if ($res) { |
347 | 347 | return $res->fetch_assoc(); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @param array|string $columns sets column that you want to retrieve , set '*' to retrieve all , default : '*' |
359 | 359 | * @param array|null $where Set your ifs default : null |
360 | 360 | */ |
361 | - public static function selectObject (string $table, array|string $columns = '*', array $where = null) { |
|
361 | + public static function selectObject(string $table, array | string $columns = '*', array $where = null) { |
|
362 | 362 | $res = self::select($table, $columns, $where, 1); |
363 | 363 | if ($res) { |
364 | 364 | return $res->fetch_object(); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return bool|Generator |
382 | 382 | */ |
383 | - public static function selectEach (string $table, array|string $columns = '*', array $where = null, int $count = null, int $offset = null): bool|Generator { |
|
383 | + public static function selectEach(string $table, array | string $columns = '*', array $where = null, int $count = null, int $offset = null): bool | Generator { |
|
384 | 384 | $res = self::select($table, $columns, $where, $count, $offset); |
385 | 385 | if ($res) { |
386 | 386 | while ($row = $res->fetch_assoc()) yield $row; |
@@ -65,17 +65,13 @@ discard block |
||
65 | 65 | public static function process (): void { |
66 | 66 | if (isset(BPT::$update->message)) { |
67 | 67 | self::processMessage(BPT::$update->message); |
68 | - } |
|
69 | - elseif (isset(BPT::$update->edited_message)) { |
|
68 | + } elseif (isset(BPT::$update->edited_message)) { |
|
70 | 69 | self::processMessage(BPT::$update->edited_message); |
71 | - } |
|
72 | - elseif (isset(BPT::$update->callback_query)) { |
|
70 | + } elseif (isset(BPT::$update->callback_query)) { |
|
73 | 71 | self::processCallbackQuery(BPT::$update->callback_query); |
74 | - } |
|
75 | - elseif (isset(BPT::$update->inline_query)) { |
|
72 | + } elseif (isset(BPT::$update->inline_query)) { |
|
76 | 73 | self::processInlineQuery(BPT::$update->inline_query); |
77 | - } |
|
78 | - elseif (isset(BPT::$update->my_chat_member)) { |
|
74 | + } elseif (isset(BPT::$update->my_chat_member)) { |
|
79 | 75 | self::processMyChatMember(BPT::$update->my_chat_member); |
80 | 76 | } |
81 | 77 | } |
@@ -131,8 +127,7 @@ discard block |
||
131 | 127 | if ($type === chatType::PRIVATE) { |
132 | 128 | if ($update->new_chat_member->status === chatMemberStatus::MEMBER) { |
133 | 129 | self::update('users', ['blocked' => false], ['id' => $update->from->id], 1); |
134 | - } |
|
135 | - else { |
|
130 | + } else { |
|
136 | 131 | self::update('users', ['blocked' => true], ['id' => $update->from->id], 1); |
137 | 132 | } |
138 | 133 | } |
@@ -208,8 +203,7 @@ discard block |
||
208 | 203 | $prepare = self::$connection->prepare($query); |
209 | 204 | if ($prepare->execute($vars)) { |
210 | 205 | return $need_result ? $prepare->get_result() : true; |
211 | - } |
|
212 | - else { |
|
206 | + } else { |
|
213 | 207 | logger::write(loggerTypes::WARNING, $prepare->error); |
214 | 208 | return false; |
215 | 209 | } |
@@ -221,8 +215,7 @@ discard block |
||
221 | 215 | foreach ($array as $name => $value) { |
222 | 216 | if ($first) { |
223 | 217 | $first = false; |
224 | - } |
|
225 | - else { |
|
218 | + } else { |
|
226 | 219 | $query .= $operator; |
227 | 220 | } |
228 | 221 | $query .= " `$name` = ?"; |
@@ -239,8 +232,7 @@ discard block |
||
239 | 232 | } |
240 | 233 | if (!empty($count)) { |
241 | 234 | $query .= !empty($offset) ? " LIMIT $offset,$count" : " LIMIT $count"; |
242 | - } |
|
243 | - elseif (!empty($offset)) { |
|
235 | + } elseif (!empty($offset)) { |
|
244 | 236 | $query .= " OFFSET $offset"; |
245 | 237 | } |
246 | 238 | return $values; |
@@ -298,7 +290,9 @@ discard block |
||
298 | 290 | public static function insert (string $table, string|array $columns, array|string $values): mysqli_result|bool { |
299 | 291 | $query = "INSERT INTO `$table`("; |
300 | 292 | $query .= '`' . (is_string($columns) ? $columns : implode('`,`', $columns)) . '`) VALUES ('; |
301 | - if (is_string($values)) $values = [$values]; |
|
293 | + if (is_string($values)) { |
|
294 | + $values = [$values]; |
|
295 | + } |
|
302 | 296 | $query .= '?' . str_repeat(',?', count($values) - 1) . ')'; |
303 | 297 | return self::query($query, $values, false); |
304 | 298 | } |
@@ -321,8 +315,7 @@ discard block |
||
321 | 315 | $query = "SELECT "; |
322 | 316 | if ($columns == '*') { |
323 | 317 | $query .= "* "; |
324 | - } |
|
325 | - else { |
|
318 | + } else { |
|
326 | 319 | $query .= '`' . (is_string($columns) ? $columns : implode('`,`', $columns)) . '` '; |
327 | 320 | } |
328 | 321 | $query .= "FROM `$table`"; |
@@ -383,8 +376,11 @@ discard block |
||
383 | 376 | public static function selectEach (string $table, array|string $columns = '*', array $where = null, int $count = null, int $offset = null): bool|Generator { |
384 | 377 | $res = self::select($table, $columns, $where, $count, $offset); |
385 | 378 | if ($res) { |
386 | - while ($row = $res->fetch_assoc()) yield $row; |
|
379 | + while ($row = $res->fetch_assoc()) { |
|
380 | + yield $row; |
|
381 | + } |
|
382 | + } else { |
|
383 | + return $res; |
|
387 | 384 | } |
388 | - else return $res; |
|
389 | 385 | } |
390 | 386 | } |
391 | 387 | \ No newline at end of file |