diff --git a/src/TgBotLib/Methods/BanChatMember.php b/src/TgBotLib/Methods/BanChatMember.php index cd3b0df..44f4f16 100644 --- a/src/TgBotLib/Methods/BanChatMember.php +++ b/src/TgBotLib/Methods/BanChatMember.php @@ -14,7 +14,7 @@ */ public static function execute(Bot $bot, array $parameters = []): true { - return (bool)$bot->sendRequest(Methods::BAN_CHAT_MEMBER->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::BAN_CHAT_MEMBER->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/BanChatSenderChat.php b/src/TgBotLib/Methods/BanChatSenderChat.php index ddd27e2..f14510d 100644 --- a/src/TgBotLib/Methods/BanChatSenderChat.php +++ b/src/TgBotLib/Methods/BanChatSenderChat.php @@ -14,7 +14,7 @@ */ public static function execute(Bot $bot, array $parameters = []): true { - return (bool)$bot->sendRequest(Methods::BAN_CHAT_SENDER_CHAT->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::BAN_CHAT_SENDER_CHAT->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/CreateChatInviteLink.php b/src/TgBotLib/Methods/CreateChatInviteLink.php index fcc4803..1ec08e8 100644 --- a/src/TgBotLib/Methods/CreateChatInviteLink.php +++ b/src/TgBotLib/Methods/CreateChatInviteLink.php @@ -14,7 +14,9 @@ */ public static function execute(Bot $bot, array $parameters = []): ChatInviteLink { - return ChatInviteLink::fromArray($bot->sendRequest(Methods::CREATE_CHAT_INVITE_LINK->value, $parameters)); + return ChatInviteLink::fromArray( + self::executeCurl(self::buildPost($bot, Methods::CREATE_CHAT_INVITE_LINK->value, $parameters)) + ); } /** diff --git a/src/TgBotLib/Methods/EditChatInviteLink.php b/src/TgBotLib/Methods/EditChatInviteLink.php index 85403da..30874b2 100644 --- a/src/TgBotLib/Methods/EditChatInviteLink.php +++ b/src/TgBotLib/Methods/EditChatInviteLink.php @@ -14,7 +14,9 @@ */ public static function execute(Bot $bot, array $parameters = []): ChatInviteLink { - return ChatInviteLink::fromArray($bot->sendRequest(Methods::EDIT_CHAT_INVITE_LINK->value, $parameters)); + return ChatInviteLink::fromArray( + self::executeCurl(self::buildPost($bot, Methods::EDIT_CHAT_INVITE_LINK->value, $parameters)) + ); } /** diff --git a/src/TgBotLib/Methods/ExportChatInviteLink.php b/src/TgBotLib/Methods/ExportChatInviteLink.php index efe6eb4..81d8c8d 100644 --- a/src/TgBotLib/Methods/ExportChatInviteLink.php +++ b/src/TgBotLib/Methods/ExportChatInviteLink.php @@ -5,6 +5,7 @@ use TgBotLib\Abstracts\Method; use TgBotLib\Bot; use TgBotLib\Enums\Methods; + use TgBotLib\Objects\ChatInviteLink; class ExportChatInviteLink extends Method { @@ -14,7 +15,7 @@ */ public static function execute(Bot $bot, array $parameters = []): string { - return $bot->sendRequest(Methods::EXPORT_CHAT_INVITE_LINK->value, $parameters); + return (string)self::executeCurl(self::buildPost($bot, Methods::EXPORT_CHAT_INVITE_LINK->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/GetFile.php b/src/TgBotLib/Methods/GetFile.php index 09b3ac7..ad01426 100644 --- a/src/TgBotLib/Methods/GetFile.php +++ b/src/TgBotLib/Methods/GetFile.php @@ -15,7 +15,7 @@ */ public static function execute(Bot $bot, array $parameters = []): File { - return File::fromArray($bot->sendRequest(Methods::GET_FILE->value, $parameters)); + return File::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_FILE->value, $parameters))); } /** diff --git a/src/TgBotLib/Methods/GetUserProfilePhotos.php b/src/TgBotLib/Methods/GetUserProfilePhotos.php index d1fa4e1..6e9529f 100644 --- a/src/TgBotLib/Methods/GetUserProfilePhotos.php +++ b/src/TgBotLib/Methods/GetUserProfilePhotos.php @@ -14,7 +14,7 @@ */ public static function execute(Bot $bot, array $parameters = []): UserProfilePhotos { - return UserProfilePhotos::fromArray($bot->sendRequest(Methods::GET_USER_PROFILE_PHOTOS->value, $parameters)); + return UserProfilePhotos::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_USER_PROFILE_PHOTOS->value, $parameters))); } /** diff --git a/src/TgBotLib/Methods/PromoteChatMember.php b/src/TgBotLib/Methods/PromoteChatMember.php index 76a973b..b17df37 100644 --- a/src/TgBotLib/Methods/PromoteChatMember.php +++ b/src/TgBotLib/Methods/PromoteChatMember.php @@ -14,7 +14,7 @@ */ public static function execute(Bot $bot, array $parameters = []): true { - return (bool)$bot->sendRequest(Methods::PROMOTE_CHAT_MEMBER->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::PROMOTE_CHAT_MEMBER->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/RestrictChatMember.php b/src/TgBotLib/Methods/RestrictChatMember.php index 1e5f5ee..7429f5c 100644 --- a/src/TgBotLib/Methods/RestrictChatMember.php +++ b/src/TgBotLib/Methods/RestrictChatMember.php @@ -24,7 +24,7 @@ $parameters['permissions'] = json_encode($parameters['permissions']); } - return (bool)$bot->sendRequest(Methods::RESTRICT_CHAT_MEMBER->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::RESTRICT_CHAT_MEMBER->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php b/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php index d612506..b83e996 100644 --- a/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php +++ b/src/TgBotLib/Methods/SetChatAdministratorCustomTitle.php @@ -14,7 +14,7 @@ */ public static function execute(Bot $bot, array $parameters = []): true { - return (bool)$bot->sendRequest(Methods::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/SetChatPermissions.php b/src/TgBotLib/Methods/SetChatPermissions.php index 5d10fda..cfd4a3f 100644 --- a/src/TgBotLib/Methods/SetChatPermissions.php +++ b/src/TgBotLib/Methods/SetChatPermissions.php @@ -24,7 +24,7 @@ $parameters['permissions'] = json_encode($parameters['permissions']); } - return (bool)$bot->sendRequest(Methods::SET_CHAT_PERMISSIONS->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_CHAT_PERMISSIONS->value, $parameters)); } /** diff --git a/src/TgBotLib/Methods/UnbanChatSenderChat.php b/src/TgBotLib/Methods/UnbanChatSenderChat.php index fe501f0..74f955b 100644 --- a/src/TgBotLib/Methods/UnbanChatSenderChat.php +++ b/src/TgBotLib/Methods/UnbanChatSenderChat.php @@ -14,7 +14,7 @@ */ public static function execute(Bot $bot, array $parameters = []): true { - return (bool)$bot->sendRequest(Methods::UNBAN_CHAT_SENDER_CHAT->value, $parameters); + return (bool)self::executeCurl(self::buildPost($bot, Methods::UNBAN_CHAT_SENDER_CHAT->value, $parameters)); } /**