Script ini berfungsi untuk mengirimkan informasi penggunaan internet di Queue Tree Mikrotik ke Bot Telegram.

:local download;
:local upload;
:local bot "BOT ID";
:local chat "CHAT ID";
:local tanggal "Tanggal: $[/system clock get date] %0A";
:foreach queue in=[/queue tree find parent="PARENT DOWNLOAD"] do={
:local name ("Nama ".[/queue tree get value-name="name" $queue]."%0A")
:local byte [/queue tree get value-name="byte" $queue];
:local byteMB ("Kuota Download ".($byte / 1024 / 1024)." Mb%0A")
:set download ($name.$byteMB)
/tool fetch url="https://api.telegram.org/bot$bot/sendmessage\?chat_id=$chat&text=Pemakaian internet: %0A$tanggal$download" keep-result=no;
}
:foreach queueUP in=[/queue tree find parent="PARENT UPLOAD"] do={
:local name ("Nama: ".[/queue tree get value-name="name" $queueUP]."%0A")
:local byte [/queue tree get value-name="byte" $queueUP];
:local byteMB ("Kuota Upload: ".($byte / 1024 / 1024)." Mb%0A")
:set upload ($name.$byteMB)
/tool fetch url="https://api.telegram.org/bot$bot/sendmessage\?chat_id=$chat&text=Pemakaian internet: %0A$tanggal$upload" keep-result=no;
}

Leave a Reply