Git Product home page Git Product logo

ilovedogs's Introduction

I love Dogs

Telegram Bot with Laravel and BotMan

My first try for build a bot following this great tutorial Build A Telegram Bot with Laravel and BotMan by Rachid Laasri.

Documentation

Tecnologies

The project is based on:

Local Enviroment

Dependences

Getting started

Install Docker:

Follow the instructions for your OS: https://docs.docker.com/install/

Clone the project:

$ git clone [email protected]:porloscerros/ilovedogs.git

Start Docker container:

$ cd ilovedogs

$ docker-compose up

Install Composer packages:

$ cd src

$ docker-compose run composer install

Configure Permissions for Laravel

$ sudo chown $USER:http ./storage -R

$ sudo chown $USER:http ./bootstrap/cache -R

$ find ./storage -type d -exec chmod 775 {} \;

$ find ./storage -type f -exec chmod 664 {} \;

$ find ./bootstrap/cache -type d -exec chmod 775 {} \;

Create a Telegram Bot

Open the Telegram app and search for BotFather, type /newbot, enter the name the username for your bot and you are good to go.

Add this to your .env file and replace YOUR_TOKEN with the token Telegram gave you:

TELEGRAM_TOKEN=YOUR_TOKEN

Ngrok

Download and extract ngrok.

cd into ngrok folder and start it:

$ ./ngrok http 8080

Link the bot to Telegram $ curl -X POST -F 'url=https://{YOU_URL}/botman' https://api.telegram.org/bot{TOKEN}/setWebhook

Eg: $ curl -X POST -F 'url=https://80c2c170.ngrok.io/botman' https://api.telegram.org/bot999999999:ABCD123AbC1Ab1-1MAQ1yzAbCdEF1xyz1/setWebhook

Test the Bot on Telegram

you will find it at the address that BotFather gave you. Eg:

t.me/ILoveDogsBot

Send he one of the following commands:

/random.

/b {breed}. Eg: /b bulldog.

/s {breed}:{subBreed}. Eg: /s hound:afghan

Start Conversation

Check response to unrecognised commands:

/cat

Stop and Destroy your Docker Development Environment

$ docker-compose down




(optional) Robo:

Install Robo globally:

$ composer global require consolidation/robo

If needed make an alias or add to PATH. Add in ~/.bashrc

$ alias robo='~/.config/composer/vendor/bin/robo'

and refresh bashrc:

$ source ~/.bashrc

Use it in /src folder. Eg:

$ robo up

$ robo composer install

$ robo artisan make:controller FallbackController

$ robo composer "require botman/driver-telegram"

ilovedogs's People

Contributors

porloscerros avatar dependabot[bot] avatar

Stargazers

Egor Borisovsky 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.