Skip to content

Commit b13bf91

Browse files
committed
))((()()(((()((()()()(()()))()()(()((((((())((()((((())((((()((((()))()()()))))())))(()()(())))((()(()))))())())))((((()))(((()))((()()()()(((())))(()))(()()(()())))(()))((())()((((()(((()()))()((()((((()((()))(())()))))(())((())())))((()((()()(((()((((())
1 parent 5a09f33 commit b13bf91

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎tgbot.deno.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,36 @@ Be grateful for your abilities and your incredible success and your considerable
653653
break;
654654
}
655655
}
656+
657+
const bezSmajliku = text.replaceAll(/\(+:|:\)+|:\(+/g, "");
658+
let open = 0;
659+
let jail = false;
660+
for (const char of bezSmajliku) {
661+
console.log(char, open);
662+
if (char === "(") {
663+
open++;
664+
} else if (char === ")") {
665+
open--;
666+
if (open < 0) {
667+
jail = true;
668+
open = 0;
669+
}
670+
}
671+
}
672+
for (let i = 0; i < open; i++) {
673+
// neyieldovat, jinak to bude rikat jail time
674+
await tgCall({
675+
chat_id: data.message.chat.id,
676+
text: ")",
677+
});
678+
}
679+
680+
if (jail) {
681+
yield await tgCall({
682+
chat_id: data.message.chat.id,
683+
text: `jail time for ${data.message.from.first_name}`,
684+
});
685+
}
656686
}
657687

658688
const decoder = new TextDecoder("utf8");

0 commit comments

Comments
 (0)