Giter Site home page Giter Site logo

mtproto-bot's Introduction

MTProto-Bot

About

Telegram client for maganing groups based on MTProto-Nodejs library with Telegraf as a bot interface

Features

Installation

First things first...

You will need to generate a Telegram bot API key and that it's easy, just follow this step-by-step. Also you should create your Telegram Client Application and get api_id and api_hash from here: https://my.telegram.org/

where_to_get_app_config

Now the environment part...

Install npm and Node.js on your machine, open a terminal then navigate to the folder where you want your project to be then run this command:

git clone https://github.com/JRakhimov/MTProto-Bot.git

You should see something like this:

Cloning into 'MTProto-Bot'...
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 17 (delta 3), reused 12 (delta 2), pack-reused 0
Unpacking objects: 100% (17/17), done.

Installing

Now it is a good time to create your environment variables file to save the API keys that was granted to you by BotFather . To create the file just run still at the root project folder:

touch .env

Once the file is created, just open it and past the following environment variables with their respective values that you own, just remember that those keys are related to you and must not be shared with anyone else, remember to always have this file in your .gitignore so that way you do not push it accidentally. Your .env file must be something like this:

BOT_TOKEN = "123456789:ABC_****" // Your telegram bot token
HOST = "https://your.domain" // Pay attention that your server must have SSL certificate and provide https connection!
BOT_NAME = "userNameOfBot" // Without "@"
API_HASH = "1eaf50c2ecs01fuidb26c1077418d5b" // Take it easy, this hash is invalid
API_ID = /\d\d\d\d\d\d/
IS_DEV = true || false // Connect to dev or production server

Running

Easiest way to launch the project is using tunnel as a host to your local machine:

npm install ngrok -g

Then just type in your terminal ngrok http 3000

get_host_using_ngrok

Finally this https url will be your host, and you can add this to your .env

After all of this setting up, just run your bot with:

npm install

npm run start

All of your bot's requests will be logged in your terminal.

sampleBot

Commands

  • /auth (auth) - Sign in to your account
  • Stay with us...

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.