Skip to content

Commit

Permalink
FIX: #191 No picture can be send
Browse files Browse the repository at this point in the history
  • Loading branch information
MiRo1310 committed Oct 14, 2024
1 parent f83b282 commit beb53aa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ You can create different groups with separate menus, and then assign users to th

### **WORK IN PROGRESS**

- FIX: #191 No picture can be send
- FEAT: #175 Copy function in Action, Renamed Switch to Toggle
- FIX: #176 Error in setDynamic value
- FIX: #181 Required values in setState
Expand Down
54 changes: 26 additions & 28 deletions src/lib/sendpic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ function sendPic(
timeouts: Timeouts[],
timeoutKey: string,
): Timeouts[] {
part.sendPic?.forEach((element) => {
const _this = TelegramMenu.getInstance();
let path = "";
if (element.id != "-") {
const url = element.id;
const newUrl = replaceAll(url, "&", "&");
try {
try {
part.sendPic?.forEach((element) => {
const _this = TelegramMenu.getInstance();
let path = "";
if (element.id != "-") {
const url = element.id;
const newUrl = replaceAll(url, "&", "&");

exec(
`curl -H "Autorisation: Bearer ${token.trim()}" "${newUrl}" > ${directoryPicture}${element.fileName}`,
(error: any, stdout: any, stderr: any) => {
Expand All @@ -39,21 +40,16 @@ function sendPic(
}
},
);
} catch (e: any) {
error([
{ text: "Error:", val: e.message },
{ text: "Stack:", val: e.stack },
]);
}

debug([{ text: "Delay Time:", val: element.delay }]);
timeoutKey += 1;
path = `${directoryPicture}${element.fileName}`;
return;
}

Check failure on line 44 in src/lib/sendpic.ts

View workflow job for this annotation

GitHub Actions / check-and-lint

Delete `⏎`
try {
path = element.fileName;
debug([{ text: "Delay Time:", val: element.delay }]);
timeoutKey += 1;
path = `${directoryPicture}${element.fileName}`;

Check failure on line 48 in src/lib/sendpic.ts

View workflow job for this annotation

GitHub Actions / check-and-lint

Delete `⏎`
} else {
return

Check failure on line 50 in src/lib/sendpic.ts

View workflow job for this annotation

GitHub Actions / check-and-lint

Insert `;`
}

const timeout = _this.setTimeout(async () => {
sendToTelegram(userToSend, path, undefined, instanceTelegram, resize_keyboard, one_time_keyboard, userListWithChatID, "");
let timeoutToClear: Timeouts[] = [];
Expand All @@ -63,19 +59,21 @@ function sendPic(
});

timeouts = timeouts.filter((item) => item.key !== timeoutKey);
debug([{ text: "Picture sended" }]);
}, parseInt(element.delay));

if (timeout) {
timeouts.push({ key: timeoutKey, timeout: timeout });
}
} catch (e: any) {
error([
{ text: "Error:", val: e.message },
{ text: "Stack:", val: e.stack },
]);
}
});
debug([{ text: "Picture sended" }]);
});
return timeouts;

Check failure on line 69 in src/lib/sendpic.ts

View workflow job for this annotation

GitHub Actions / check-and-lint

Delete `⏎`

} catch (e: any) {
error([
{ text: "Error:", val: e.message },
{ text: "Stack:", val: e.stack },
]);
}
return timeouts;
}

Expand Down

0 comments on commit beb53aa

Please sign in to comment.