根据“信息”做出回应

Make response based on "message"

本文关键字:回应 信息 根据      更新时间:2023-09-26

我想为聊天做一个自动回复,我不知道从哪里开始。

表单数据为;

{"channel":"#channel","message":"Hello","attributes":[{"type":"italic","start":0,"end":1},{"type":"color","start":0,"end":1,"color":128}],"token":"oausia9saUSiau98SsUASyuaysI","action":false,"request":"send"}

所以每当有人写你好,我想回复消息你好,你好吗?

我不完全知道它必须写什么语言,以及我应该如何编码它来做出响应?

将表单数据发送到php页面,就像这样(通过ajax或常规表单发送):

<?php
$msg = strtolower($_POST['message']);
if($msg == 'hello'){
  echo 'Hello, how are you?';
  exit;
}
else if($msg == 'bye'){
  echo 'Good bye!';
  exit;
}
?>