Kumpulan Script Mikrotik Bot Telegram Memberi Tahu User Remove ✰ [ Validated ]

/tool fetch url=$url http-method=post http-data=$data keep-result=no

:local url "https://api.telegram.org/bot$tgToken/sendMessage" :local postData "chat_id=$tgChatId&text=$[:escape $message]&parse_mode=HTML"

Note: The scheduler approach assumes removal = deletion. Adjust logic as needed. This script can be manually tested or called from a log trigger. :local chatId \"YOUR_CHATID\"

/system script run set-telegram-vars /system script add name="notify-user-removed" source= :global tgToken :global tgChatId :local logMsg "$[/system clock get date] $[/system clock get time] - User removed: $[/log get $1 message]" :local message "🚫 User removed from Mikrotik\n$logMsg"

:local now [/system clock get date] . " " . [/system clock get time] :local text "⚠️ <b>User Removed</b>\n👤 Name: $userName\n⏰ Time: $now\n🏷️ Router: [/system identity get name]" :local name \"\$1\"

/system scheduler add name="check-removed-users" interval=1m on-event= :local lastRun [/system clock get time] :foreach u in=[/ppp secret find where disabled=yes] do= :local name [/ppp secret get $u name] :log info "Removed user detected: $name" /system script run notify-user-removed /ppp secret remove $u

Run once:

:local url "https://api.telegram.org/bot$token/sendMessage" :local data "chat_id=$chatId&text=$[:escape $text]&parse_mode=HTML"

/system script add name="send-telegram-user-removed" owner=admin source= # --- CONFIGURATION --- :local token "1234567890:ABCdefGHIJKlmnoPQRstUVWXYZ" :local chatId "-123456789" # --- END CONFIG --- :local userName $1 :if ([ :len $userName ] = 0) do= :set userName "unknown" :local text \"User \$name removed\"

To trigger manually:

# Copy-paste sequence (adjust token & chatId) /system script add name=telegram-removed source=":local token \"YOUR_TOKEN\"; :local chatId \"YOUR_CHATID\"; :local name \"\$1\"; :local text \"User \$name removed\"; /tool fetch url=\"https://api.telegram.org/bot\$token/sendMessage?chat_id=\$chatId&text=\$[:escape \$text]\" keep-result=no" /log add topics=ppp,info action=script script=telegram-removed This completes the technical documentation for the .

Previous
Previous

Eating 30 plants a week

Next
Next

Converting salt and sodium