From 4963691fa66a98d869edee9b6c86864a769d341c Mon Sep 17 00:00:00 2001 From: furaihan Date: Sun, 30 Aug 2020 17:27:12 +0700 Subject: [PATCH] code cleanup --- cpu-monitoring | 5 ++--- first-setup | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cpu-monitoring b/cpu-monitoring index ab7ad4b..06923c9 100644 --- a/cpu-monitoring +++ b/cpu-monitoring @@ -15,9 +15,8 @@ foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)} :put $totalcpuarray local avgcpu ($totalcpuarray / [:len $cpuarray]) if ($avgcpu > 65) do={ - global CheckConnection - $CheckConnection - global ConnectionAvailable + :global ConnectionAvailable + $ConnectionAvailable if ($ConnectionAvailable=true) do={ global CHATID global BOTID diff --git a/first-setup b/first-setup index 5beccf7..cc34d88 100644 --- a/first-setup +++ b/first-setup @@ -3,11 +3,9 @@ :global CHATID ("-4936xxx") #Change telegram bot id below with your own :global BOTID ("62xxxxxxxx:AAExxxx") -:global GetMacVendor -:set GetMacVendor do={ - local MacAddress [:tostr $1] +:global GetMacVendor do={ :do { - local result ([/tool fetch mode=https http-method=get url=("https://api.macvendors.com/".[:pick [:tostr $MacAddress] 0 8 ]) as-value output=user ]->"data") + local result ([/tool fetch mode=https http-method=get url=("https://api.macvendors.com/".[:pick [:tostr $1] 0 8 ]) as-value output=user ]->"data") return $result } on-error={ return "Error! this probably cause from unknown vendor or a connection problem" @@ -48,7 +46,7 @@ :set internet false; } } - :return $internet + :return [:tobool $internet] } #This script is inspired by TSOKOTSA's script published in the Mikrotik forum :global GenerateRandomString do={