Var TOKEN='I robot inside TOKEN;
Var BASE_URL='https://api.sydney.im:8443/' + + '/' TOKEN;
The function doGet (e) {
Const code={
Res: true
}
Return ContentService. CreateTextOutput (JSON. Stringify (code))
SetMimeType (ContentService. MimeType. JSON);
}
The function the doPost (e) {
Var bodys=JSON. Parse (e.p ostData. Contents).
Logger. The log (bodys)
Mongo. Insert (" nowmoer ", e)
For (var I=0; I & lt; Bodys. Length; I++) {
The body=bodys [I];
If (body) {
Mongo. Insert (" nowmoer ", body)
Content=preparePayload (body);
ToPotato (content)
}
}
}
The function toPotato (content) {
Logger. The log (content)
If (Array. IsArray (content) {
Payloads=content;
} else {
Payloads=[content];
}
Logger. The log (payloads)
For (var I=0; I & lt; Payloads. Length; I++) {
Content=payloads [I];
If (content) {
Var res=postPotato (content);
Logger. The log (res)
}
}
}
The function setWebhook () {//bind setWebhook function, please run this function
Var setWebhook={
Method: 'setWebhook',
Content: {
Url: 'I fill I released after the network deployment url'
}
}
Logger. The log (postPotato (setWebhook))
}
The function postPotato (content) {
Var data={
https://bbs.csdn.net/topics/'contentType' : 'application/json,
"Method" : "post",
"Content" : JSON. Stringify (content. Content
}
Var response=UrlFetchApp. The fetch (BASE_URL + content. Method, data);
Var res=JSON. Parse (response);
Mongo. Insert (" nowmoer res)
Return res;
}
The function preparePayload (body) {
If (body. The message & amp; & Body. The message. The text) {
If (body. Message. From the id=21564027) {
Return null
}
Var sendTextMessage={
Method: 'sendTextMessage',
Content: {
"Chat_type" : the body message. Chat. Type,
"Chat_id" : the body message. Chat. Id,
"Text" : mest,
"Markdown" : true,
}
}
Var mest=body. The message. The text;
If (mest=='small owners') {
Var zhangmeng=[' hello ', 'hi,]
SendTextMessage. Content. The text='zhangmeng'
Return sendTextMessage
}
If (mest) {
SendTextMessage. Content. The text=mest
Return sendTextMessage
}
}
}