Jump to content

Control your Keenetic via Telegram


Recommended Posts

Chat with your Keenetic CLI via Telegram like a pro!:)

b92d38f5d243.png

  • Install necessary Entware packages:
    opkg install bash curl dtach
     

     

  • Download the bash-script, which serving as Telegram bot:
    curl --output /opt/bin/bashbot.sh --insecure https://raw.githubusercontent.com/ryzhovau/telegram-bot-bash/master/opt/bin/bashbot.sh
    curl --output /opt/bin/JSON.sh --insecure https://raw.githubusercontent.com/ryzhovau/telegram-bot-bash/master/opt/bin/JSON.sh
    curl --output /opt/etc/init.d/S51bashbot  --insecure https://raw.githubusercontent.com/ryzhovau/telegram-bot-bash/master/opt/etc/init.d/S51bashbot
    chmod +x /opt/bin/bashbot.sh
    chmod +x /opt/bin/JSON.sh
    chmod +x /opt/etc/init.d/S51bashbot
     

     

  • Ask @BotFather to create a new boot and remember auth token for it.
  • Write down this token to TOKEN='' string at /opt/bin/bashbot.sh.
  • Replace following string in /opt/bin/bashbot.sh
    *) msg="$MESSAGE";;
     

    to

    *) msg=$(ndmq -p "$MESSAGE" -x);;
     

     

  • Start bot buy typing /opt/etc/init.d/S51bashbot start. This bot will start automatically on every boot.

Please, keep in mind security question like authorisation, which is outside of this How-To. This is just proof-of-concept, which you can edit for your needs.

Bot log can be found at /opt/var/log/bashbot.log.

 

  • Thanks 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...