Giter VIP home page Giter VIP logo

go_ctl_bot's Introduction

CTL bot

CTL bot is a universal Telegram bot for executing shell commands on the server. It enables you to declare a bot menu and a list of executed commands using a configuration file.

Requirements

Get Your Telegram Bot Token

To get your Telegram bot token, you'll need to create a new bot on Telegram. Follow these steps:

  1. Open Telegram and search for the "BotFather" bot.
  2. Start a chat with the BotFather and use the /newbot command to create a new bot.
  3. Follow the instructions and provide a name and username for your bot.
  4. Once the bot is created, the BotFather will provide you with a token. Keep this token safe; you'll need it to run the bot.

Installation and Setup

  1. Clone the repo

    git clone https://github.com/Kroks4502/go_ctl_bot
    cd go_ctl_bot
  2. Install dependencies

    go mod tidy
  3. Now edit a file config.yml to store your bot token and configure menu.

    vi config.yml
  4. Now open the terminal and type the following command to spin up the bot locally:

    go run .

Configuration

To specify which configuration file to load, use the --config.file flag.

The file is written in YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional.

A valid example file can be found here.

token: 'YOUR_TOKEN'   # Telegram Bot Token
debug: false          # Get more information about the requests being sent to Telegram
admins:               # List users ids who can use bot
  - YOUR_TG_USER_ID
menu:                 # Bot menu options
  <menu_section>

<menu_section>

title: '...'      # Message & button title
buttons:          # List submenu
  [ - <menu_section> ... ]
command:          # Shell-command to run on the server when this menu item is selected
  [ <command_section> ]

<command_section>

name: 'shell-command'
args:
  [ - 'arg' ... ]

Using the Bot

  • Open Telegram and search for your bot using the username you provided during bot creation.
  • Send the /start command to your bot.
  • Now your can use the menu for control the server.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

go_ctl_bot's People

Contributors

kroks4502 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.