bot telegram user hotspot

Anda bisa membuat, menghapus, disable, enable dan merubah profile user hotspot mikrotik hanya dengan bantuan bot telegram cukup dengan menggunakan System Script dan System Scheduler pada mikrotik tanpa harus punya server PHP sendiri, ini cukup mudah dipasang dan digunakan bagi orang awam yang tidak paham pemograman PHP..

Agar script ini berjalan dengan semestinya anda harus membuat terlebih dahulu bot telegram interaktif yang terdapat pada postingan berikut ini: Monitoring Mikrotik dengan Bot Telegram Interaktif tanpa Pemograman PHP

Baca juga: Cek Kuota Voucher Hotspot dengan Bot Telegram

Perintah pada bot:

  • /hotspot add namaUser passwordUser -> Untuk membuat user hotspot dengan profil yang sudah ditentukan, sebelumnya ubah terlebih dahulu nama profil yang akan digunakan.
  • /hotspot delete namaUser -> Untuk hapus user hotspot
  • /hotspot disable namaUser -> Untuk men-disable user hotspot
  • /hotspot enable namaUser -> Untuk men-aktifkan user hotspot
  • /hotspot setprofil namaUser namaProfileBaru -> Untuk mengganti profil pada user hotspot
  • /hotspot pasword namaUser PasswordBaru -> Untuk mengganti pasword user hotspot
  • /hotspot print -> Untuk menampilkan detail user hotspot yang aktif
  • /hotspot user namaProfile -> Untuk menampilkan user hotspot berdasarkan nama profile

Buat Script dengan nama “tg_cmd_hotspot”

Share to Unlock Contentimage/svg+xml

Silahkan share untuk membuka link download dan membuka scriptnya

Apabila tutorial ini bermanfaat support saya dengan cara share artikel ini.. Terimakasih 

Menampilkan detail user hotspot yang sedang aktif active
Menampilkan user hotspot

62 COMMENTS

  1. pak, kalau nambah parameter baru gimana ya, seperti nambah limit-uptime. sementara ini saya masih manual seperti ini
    /ip hotspot user add name=$param2 password=$param3 profile=uprof3 limit-uptime=2h
    terimakasih

        • Mungkin solusinya username dan pasword menggunakan param2, untuk limit-uptime menggunakan param3, tinggal nanti menggunakan perintah ganti pasword saja..hehe

          /ip hotspot user add name=$param2 password=$param2 profile=Mahasiswa limit-uptime=$param3

        • Ijin menambahkan pak, mungkin bisa dicoba
          saya sdh praktek penambahan sampai $param4

          :local param1 [:pick $params 0 [:find $params ” “]]
          :local param2 [:pick $params ([:find $params ” “]+1) [:len $params]]

          :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]]]]

          :local param4 [:pick [: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]]]] ([:find [:pick $params ([:find $params ” “]+1) [:len $params]] ” “]+1) [:len [:pick $params ([:find $params ” “]+1) [:len $params]]]]

          :if ([:len [:find $param2 ” “]]>0) do={
          :set param2 [:pick [:pick $params ([:find $params ” “]+1) [:len $params]] 0 [:find [:pick $params ([:find $params ” “]+1) [:len $params]] ” “]]
          }

          :if ([:len [:find $param3 ” “]]>0) do={
          :set param3 [:pick [:pick [:pick $params ([:find $params ” “]+1) [:len $params]] ([:find $params ” “]+1) [:len $params]] 0 [:find [:pick $params ([:find $params ” “]+1) [:len $params]] ” “]]
          } else={
          :set param4 “”
          }

  2. assalamualaikum pak, saat saya ketik /hotspot print tidak mau keluar pak user yang aktif. itu kenapa ya pak

    • walikumsalam,,coba matikan dulu schedulenya,lalu jalankan perintah tersebut,dan jalankan perintah di new terminal -> system script run tg_getUpdates, pasti kalau ga jalan ada error yg muncul disana

  3. Untuk script ini apakah harus ada yg di rubah?
    saya coba /hotspot tidak ada respon, kalau /cpu, /ping, /public lancar semua

          • Saya Pakai Script di Artikel Normal,
            Terus Saya Pakai Script ini Gagal Mas, gak ada notif Berhasil dan Gak buat user.
            Ini Script nya.

            :local send [:parse [/system script get tg_sendMessage source]]
            :local param1 [:pick $params 0 [:find $params ” “]]
            :local param2 [:pick $params ([:find $params ” “]+1) [:len $params]]
            :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]]]]
            :if ([:len [:find $param2 ” “]]>0) do={
            :set param2 [:pick [:pick $params ([:find $params ” “]+1) [:len $params]] 0 [:find [:pick $params ([:find $params ” “]+1) [:len $params]] ” “]]
            } else={
            :set param3 “”
            }

            :put $params
            :put $param1
            :put $param2
            :put $param3
            :put $chatid
            :put $from

            /ip hotspot user add name=$param1 password=$param2 profile=$param3
            $send chat=$chatid text=(“Username: $param2 Password: $param3 profile : $param3 Berhasil dibuat…”) mode=”Markdown”
            }
            :if ($param1=”delete”) do={
            /ip hotspot user remove [find name=$param2]
            $send chat=$chatid text=(“User: $param2 Berhasil dihapus”) mode=”Markdown”
            }
            :if ($param1=”disable”) do={
            /ip hotspot user disable [find name=$param2]
            $send chat=$chatid text=(“User: $param2 Berhasil di disable”) mode=”Markdown”
            }
            :if ($param1=”enable”) do={
            /ip hotspot user enable [find name=$param2]
            $send chat=$chatid text=(“User: $param2 Berhasil di enable”) mode=”Markdown”
            }
            :if ($param1=”setprofil”) do={
            /ip hotspot user set profile=$param3 [find name=$param2]
            /ip hotspot active remove [find name=$param2]
            $send chat=$chatid text=(“User: $param2 Berhasil diganti profile menjadi $param3…”) mode=”Markdown”
            }
            :if ($param1=”pasword”) do={
            /ip hotspot user set password=$param3 [find name=$param2]
            /ip hotspot active remove [find name=$param2]
            $send chat=$chatid text=(“User: $param2 pasword diganti menjadi $param3…”) mode=”Markdown”
            }
            :if ($params=”print”) do={
            :local output
            :foreach activeIndex in=[/ip hotspot active find] do={
            :local activeUser (“*Username:* “.[/ip hotspot active get value-name=”user” $activeIndex].”%0A”)
            :local activeAddress (“*Address:* “.[/ip hotspot active get value-name=”address” $activeIndex].”%0A”)
            :local activeMACAddr (“*MAC Address:* “.[/ip hotspot active get value-name=”mac-address” $activeIndex].”%0A”)
            :local activeLoginBy (“*Login by:* “.[/ip hotspot active get value-name=”login-by” $activeIndex].”%0A”)
            :local activeUptime (“*Uptime:* “.[/ip hotspot active get value-name=”uptime” $activeIndex].”%0A”)
            :set output ($output.$activeUser.$activeAddress.$activeMACAddr.$activeUptime.$activeLoginBy.”%0A”)
            }
            $send chat=$chatid text=(“$output”) mode=”Markdown”
            }

  4. ga work add,delete user nya

    :local send [:parse [/system script get tg_sendMessage source]]
    :local param1 [:pick $params 0 [:find $params ” “]]
    :local param2 [:pick $params ([:find $params ” “]+1) [:len $params]]
    :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]]]]
    :if ([:len [:find $param2 ” “]]>0) do={
    :set param2 [:pick [:pick $params ([:find $params ” “]+1) [:len $params]] 0 [:find [:pick $params ([:find $params ” “]+1) [:len $params]] ” “]]
    } else={
    :set param3 “”
    }

    :put $params
    :put $param1
    :put $param2
    :put $param3
    :put $chatid
    :put $from

    :if ($param1=”add”) do={
    /ip hotspot user add name=$param2 password=$param3 profile=Mahasiswa
    $send chat=$chatid text=(“Username: $param2 Password: $param3 Berhasil dibuat…”) mode=”Markdown”
    }
    :if ($param1=”delete”) do={
    /ip hotspot user remove [find name=$param2]
    $send chat=$chatid text=(“User: $param2 Berhasil dihapus”) mode=”Markdown”
    }
    :if ($param1=”disable”) do={
    /ip hotspot user disable [find name=$param2]
    $send chat=$chatid text=(“User: $param2 Berhasil di disable”) mode=”Markdown”
    }
    :if ($param1=”enable”) do={
    /ip hotspot user enable [find name=$param2]
    $send chat=$chatid text=(“User: $param2 Berhasil di enable”) mode=”Markdown”
    }
    :if ($param1=”setprofil”) do={
    /ip hotspot user set password=$param3 [find name=$param2]
    /ip hotspot active remove [find name=$param2]
    $send chat=$chatid text=(“User: $param2 Berhasil diganti profile menjadi $param3…”) mode=”Markdown”
    }
    :if ($param1=”pasword”) do={
    /ip hotspot user set password=$param3 [find name=$param2]
    /ip hotspot active remove [find name=$param2]
    $send chat=$chatid text=(“User: $param2 pasword diganti menjadi $param3…”) mode=”Markdown”
    }
    :if ($params=”print”) do={
    :local output
    :foreach activeIndex in=[/ip hotspot active find] do={
    :local activeUser (“*Username:* “.[/ip hotspot active get value-name=”user” $activeIndex].”%0A”)
    :local activeAddress (“*Address:* “.[/ip hotspot active get value-name=”address” $activeIndex].”%0A”)
    :local activeMACAddr (“*MAC Address:* “.[/ip hotspot active get value-name=”mac-address” $activeIndex].”%0A”)
    :local activeLoginBy (“*Login by:* “.[/ip hotspot active get value-name=”login-by” $activeIndex].”%0A”)
    :local activeUptime (“*Uptime:* “.[/ip hotspot active get value-name=”uptime” $activeIndex].”%0A”)
    :set output ($output.$activeUser.$activeAddress.$activeMACAddr.$activeUptime.$activeLoginBy.”%0A”)
    }
    $send chat=$chatid text=(“$output”) mode=”Markdown”
    }
    :if ($param1=”user”) do={
    :local output
    :foreach activeIndex in=[/ip hotspot user find profile=$param2] do={
    :local user (“*Username:* “.[/ip hotspot user get value-name=”name” $activeIndex].”%0A”)
    :local password (“*Password:* “.[/ip hotspot user get value-name=”password” $activeIndex].”%0A”)
    :local uptime (“*Uptime:* “.[/ip hotspot user get value-name=”uptime” $activeIndex].”%0A”)
    :set output ($output.$user.$password.$uptime.”%0A”)
    }
    $send chat=$chatid text=(“$output”) mode=”Markdown”
    }

    cuman yg work print aja mas

    ada fb ga/wa mas mau tanya2

  5. saya ada beberapa user dan user profile
    katakan
    user 1 = user profile 1
    user 2 = user profile 2

    Rencana saya ingin membuat 1 script tg_cmd_gantiprofilX
    kemudian saya tinggal panggil di menu telegram gantiprofilX
    tujuannya untuk mengubah semua user (user 1 dan 2) ke user profile X
    itu scriptnya bagaimana ya Pak?
    Soalnya saya ada banyak user, yang profile nya mau saya set ke 1profile untuk sesaat

  6. bang kalau mau print salah satu user saja dengan cara panggil username atau addressnya gimana caranya yaa ?
    dan saat di print out juga bisa keliatan kuota yang sudah di pakai sma user tersebut gimna caranya bang ?
    mintol bantuannya

  7. selamat pagi pak… mohon bantuannya … kok saya nambah perintah
    :local activeTxRate (“*Tx Ratet:* “.[/ip hotspot active get value-name=”tx-rate” $activeIndex].”%0a”)

    kok gak ada respon ya.. kalau untuk bytes out bisa.. kenapa ya?

  8. Bang buat video tentang penjelasan script nya dong, pengen tau sekalian belajar juga mengenai fungsi” dari script tersebut. Hehe

  9. jika ingin menampilkan print pada netwatch bagaimana pak, jika pakai fitur ini, jadi pada saat ketik /netwatch print, data pada netwatch terkirim ke dalam bot

  10. bang untuk scrip hotspot print kadang tadi kemarin bisa tampil, pagi tadi gak bisa tampil, baru sore ini bisa tampil lagi kira2 kenapa bang
    untuk script add delete dll bisa tampil

  11. cara mengatasinya gmn bang… ni saya tambah script hanya jumlah hotspot yang aktif jg bisa tampil contoh 8 user Online, khusus hotspot print tidak bisa tampil bang..

  12. pak, bisa atau tidak ya kirim notifikasi untuk pendaftaran user hotspot ? contohnya, ketika ada seseorang yang mendaftar, langsung dikirim notifikasi bahwa ada user yang telah terdaftar dengan nama “a”, begitu pak? bisa atau tidak ya kira2…

  13. iya betul seperti itu, rencananya menggunakan form pendaftaran user, nah ketika sudah diaktivasi maka otomatis user yang telah didaftarkan akan masuk ke mikrotik (add user melalui web menggunakan API) nah setelah itu muncul notifikasi ke bot telegram, begitu maksud saya pak… maaf jika kurang jelas penjelasannya

  14. assalamu’alaikum pak…
    bot telegram apa bisa eksekusi script yg udah dibuat di mikrotik ya?
    dalam system>script : ada scheduller “limit user” dan “reset user”.
    misal, jika jatuh tempo pembayaran user akan terlimit speednya dengan script “limit user” yg dischedulkan.
    nah ketika user sudah bayar maka harus menjalankan “reset user”.

    yang jadi pertanyaan untuk menjalankan “reset user” bisa dieksekusi lewat bot telegram ga pak..
    mohon pencerahannya.

  15. Kalau dibaca dari alur proses/algoritmanya, berarti ini kita mengakses terminal mikrotik via telegram dan kita dapat melakukan semua command line-nya via telegram tersebut.
    Benarkah demikian Pak?

    • Bila memang benar begitu. bisakah juga untuk perintah2 yg interaktif (misal : /system telnet xxx.xxx.xxx.xxx)?

Leave a Reply to nata adiCancel reply