Move parse_mode statements

main
Astra 2024-09-06 02:16:29 +01:00
parent 5896a3db3f
commit 55672d5b55
1 changed files with 6 additions and 4 deletions

10
cli.ts
View File

@ -19,6 +19,9 @@ async function makeTelegramRequest(
switch (command) {
case "sendMessage": {
formData.append("text", additionalParam.text);
if (additionalParam.parse_mode) {
formData.append("parse_mode", additionalParam.parse_mode);
}
break;
}
case "sendMediaGroup": {
@ -57,6 +60,9 @@ async function makeTelegramRequest(
if (additionalParam.caption) {
formData.append("caption", additionalParam.caption);
}
if (additionalParam.parse_mode) {
formData.append("parse_mode", additionalParam.parse_mode);
}
break;
}
case "deleteMessage": {
@ -69,10 +75,6 @@ async function makeTelegramRequest(
}
}
if (additionalParam.parse_mode && command != "sendMediaGroup") {
formData.append("parse_mode", additionalParam.parse_mode);
}
const response = await fetch(url, {
method: "POST",
body: formData,