Advertisement
sopyanx

tg_cmd_hotspot

Feb 17th, 2020
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.28 KB | None | 0 0
  1. :local send [:parse [/system script get tg_sendMessage source]]
  2. :local param1 [:pick $params 0 [:find $params " "]]
  3. :local param2 [:pick $params ([:find $params " "]+1) [:len $params]]
  4. :local param3 [:pick [:pick $params ([:find $params " "]+1) [:len $params]] ([:find [:pick $params ([:find $params " "]+1) [:len $params]] " "]+1) [:len [:pick $params ([:find $params " "]+1) [:len $params]]]]
  5. :if ([:len [:find $param2 " "]]>0) do={
  6.     :set param2 [:pick [:pick $params ([:find $params " "]+1) [:len $params]] 0 [:find [:pick $params ([:find $params " "]+1) [:len $params]] " "]]
  7. } else={
  8.     :set param3 ""
  9. }
  10.  
  11. :put $params
  12. :put $param1
  13. :put $param2
  14. :put $param3
  15. :put $chatid
  16. :put $from
  17.  
  18. :if ($param1="add") do={
  19. /ip hotspot user add name=$param2 password=$param3 profile=Mahasiswa
  20. $send chat=$chatid text=("Username: $param2 Password: $param3 Berhasil dibuat...") mode="Markdown"
  21. }
  22. :if ($param1="delete") do={
  23. /ip hotspot user remove [find name=$param2]
  24. $send chat=$chatid text=("User: $param2 Berhasil dihapus") mode="Markdown"
  25. }
  26. :if ($param1="disable") do={
  27. /ip hotspot user disable [find name=$param2]
  28. $send chat=$chatid text=("User: $param2 Berhasil di disable") mode="Markdown"
  29. }
  30. :if ($param1="enable") do={
  31. /ip hotspot user enable [find name=$param2]
  32. $send chat=$chatid text=("User: $param2 Berhasil di enable") mode="Markdown"
  33. }
  34. :if ($param1="setprofil") do={
  35. /ip hotspot user set password=$param3 [find name=$param2]
  36. /ip hotspot active remove [find name=$param2]
  37. $send chat=$chatid text=("User: $param2 Berhasil diganti profile menjadi $param3...") mode="Markdown"
  38. }
  39. :if ($param1="pasword") do={
  40. /ip hotspot user set password=$param3 [find name=$param2]
  41. /ip hotspot active remove [find name=$param2]
  42. $send chat=$chatid text=("User: $param2 pasword diganti menjadi $param3...") mode="Markdown"
  43. }
  44. :if ($params="print") do={
  45. :local output
  46. :foreach activeIndex in=[/ip hotspot active find] do={
  47. :local activeUser ("*Username:* ".[/ip hotspot active get value-name="user" $activeIndex]."%0A")
  48. :local activeAddress ("*Address:* ".[/ip hotspot active get value-name="address" $activeIndex]."%0A")
  49. :local activeMACAddr ("*MAC Address:* ".[/ip hotspot active get value-name="mac-address" $activeIndex]."%0A")
  50. :local activeLoginBy ("*Login by:* ".[/ip hotspot active get value-name="login-by" $activeIndex]."%0A")
  51. :local activeUptime ("*Uptime:* ".[/ip hotspot active get value-name="uptime" $activeIndex]."%0A")
  52. :set output ($output.$activeUser.$activeAddress.$activeMACAddr.$activeUptime.$activeLoginBy."%0A")
  53. }
  54. $send chat=$chatid text=("$output") mode="Markdown"
  55. }
  56. :if ($param1="user") do={
  57. :local output
  58. :foreach activeIndex in=[/ip hotspot user find profile=$param2] do={
  59. :local byteout [/ip hotspot user get value-name="bytes-out" $activeIndex];
  60. :local bytein [/ip hotspot user get value-name="bytes-in" $activeIndex];
  61. :local kuota ("*Kuota Terpakai: * ".(($byteout+$bytein) / 1024 / 1024)."Mb %0A");
  62. :local user ("*Username:* ".[/ip hotspot user get value-name="name" $activeIndex]."%0A")
  63. :local password ("*Password:* ".[/ip hotspot user get value-name="password" $activeIndex]."%0A")
  64. :local uptime ("*Uptime:* ".[/ip hotspot user get value-name="disable" $activeIndex]."%0A")
  65. :set output ($output.$user.$password.$uptime.$kuota."%0A")
  66. }
  67. $send chat=$chatid text=("$output") mode="Markdown"
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement