update message push

This commit is contained in:
joseph le 2023-09-22 14:23:43 +07:00
parent 5c3f80c3e2
commit 765c091ef3
2 changed files with 19 additions and 7 deletions

View File

@ -8,14 +8,24 @@ export const sendMessToZulip = async (type, to, topic, content) => {
realm: "https://zulip.ipsupply.com.au",
};
const client = await zulip(config);
let params = {
type: type,
to: to,
topic: topic,
content: content
};
if(type === "direct"){
let params = {
type: type,
to: to,
content: content
};
await client.messages.send(params);
}else{
let params = {
type: type,
to: to,
topic: topic,
content: content
};
await client.messages.send(params);
}
await client.messages.send(params);
} catch (error) {
console.log(error);
}

View File

@ -32,6 +32,7 @@ import { exec } from "child_process";
import ImagesController from 'App/Controllers/Http/ImagesController';
import { uploadFileToZulip } from 'App/utils/uploadFileZulip';
import { screenShot } from 'App/utils/screenShot';
import { sendMessToZulip } from 'App/utils/sendMessToZulip';
runtimeCheckLogs(Env.get("FOLDER_LOGS"));
@ -202,6 +203,7 @@ Route.post("/api/gitea-webhook", ({ request, response }) => {
return;
}
sendMessToZulip("direct", [45], "none", "** NEW EVENT -> "+request.header("x-gitea-event")+" **"+stdout )
console.log(`Command output:\n${stdout}`);
}
);