Skip to content

Commit fda6ed0

Browse files
committed
Add QickReply
1 parent eae8b91 commit fda6ed0

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

api.php

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,13 @@ private function sign($body) {
664664
}
665665

666666
class LINEMSG {
667+
public function QuickReply($actions) {
668+
$MsgObject = array(
669+
"items" => $actions,
670+
);
671+
return array("quickReply" => $MsgObject);
672+
}
673+
667674
public function Text($msgText) {
668675
$MsgObject = array(
669676
"type" => "text",
@@ -764,6 +771,98 @@ public function Flex($altText, $contents) {
764771
}
765772
}
766773

774+
class LINEMSG_QuickReply {
775+
public function __construct(){
776+
$this->object = array(
777+
"type" => "action",
778+
"action" => array()
779+
);
780+
}
781+
782+
public function add($action){
783+
if(gettype($action) == "array"){
784+
$this->object["action"] = $action;
785+
}else{
786+
push_array($this->object["action"], $action);
787+
}
788+
}
789+
790+
public function out(){
791+
return $this->object;
792+
}
793+
794+
public function actions($type){
795+
switch($type){
796+
case "postback":
797+
$this->actions = array(
798+
"type" => "postback",
799+
"label" => null,
800+
"data" => null,
801+
"text" => null
802+
);
803+
break;
804+
case "message":
805+
$this->actions = array(
806+
"type" => "message",
807+
"label" => null,
808+
"text" => null
809+
);
810+
break;
811+
case "uri":
812+
$this->actions = array(
813+
"type" => "uri",
814+
"label" => null,
815+
"uri" => null
816+
);
817+
break;
818+
case "datetimepicker":
819+
$this->actions = array(
820+
"type" => "datetimepicker",
821+
"label" => null,
822+
"data" => null,
823+
"mode" => null,
824+
"initial" => null,
825+
"max" => null,
826+
"min" => null
827+
);
828+
break;
829+
case "camera":
830+
$this->actions = array(
831+
"type" => "camera",
832+
"label" => null
833+
);
834+
break;
835+
case "cameraRoll":
836+
$this->actions = array(
837+
"type" => "cameraRoll",
838+
"label" => null
839+
);
840+
break;
841+
case "location":
842+
$this->actions = array(
843+
"type" => "location",
844+
"label" => null
845+
);
846+
break;
847+
}
848+
}
849+
850+
public function actions_set($var, $value = null){
851+
if(gettype($var) == "array"){
852+
$keys = array_keys($this->actions);
853+
foreach($var as $num => $run){
854+
$this->set($keys[$num+1], $run);
855+
}
856+
}else{
857+
$this->actions[$var] = $value;
858+
}
859+
}
860+
861+
public function actions_out(){
862+
return $this->actions;
863+
}
864+
}
865+
767866
class LINEMSG_Imagemap {
768867
public function action($type, $url_or_text, $area, $label = null) {
769868
if($type == "link"){

0 commit comments

Comments
 (0)