Git Product home page Git Product logo

30-lines-telegram-bot's Introduction

Logo

2Space - Telegram Bot in 30 Lines of Code Example

You can try it out on telegram - @tospace

This telegram bot is a little bit more than standard "Hello World" application - it does something. It gets the information about closest launches of spacecrafts.

This library was created to illustrate a bot creation process as simple as it possible.

I have created it as a demo for my presentation on IT NonStop Wroclaw. Links and descriptions are going to be provided when event will happen.

Environment

It works literally everywhere. Server is not mandatory - it works well from your personal device.

Running

  1. Register your bot with @botfather. It will give you a token
  2. Create token file: cp token-example.js token.js
  3. Place your token string inside
  4. npm install
  5. npm start
  6. Enjoy. Just type your bot a message in telegram

Warning

It is not production ready solution (I know, it's obvious, but...). In real life it makes sense to use a way more complicated algorithms of language recognition, not indexOf. Also in real life it's a very bad idea to hardcore URLs like it's done in the example. Only morons do so on real projects. Storing cases in one folder is not a good practice either, some architecture is very helpful. Just imagine it's kind of router and cases are action of controllers - with such abstraction life is way easier.

Credentials

Data is provided by API - https://launchlibrary.net Icon used for application was taken here https://www.flaticon.com/authors/smashicons

Project uses 2 libraries: node-telegram-bot-api and request.

Thank you for checking this page.

30-lines-telegram-bot's People

Contributors

tryshchenko avatar

Watchers

James Cloos 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.