Git Product home page Git Product logo

etsiinfbot's Introduction

ETSIINFbot

Installation

  • Clone repository
git clone https://github.com/svg153/ETSIINFbot.git
  • Update dependencies

    • move to ETSIINFbot folder

      php composer.phar global require "fxp/composer-asset-plugin:^1.2.0"
      
      php composer.phar update
      
  • Dependencies problems

    • longman/telegram-bot 0.35 requires ext-curl * -> the requested PHP extension curl is missing from your system.

      sudo apt-get install php-curl
      
    • yiisoft/yii2 2.0.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

      sudo apt-get install php-mbstring
      
    • Exception 'yii\db\Exception' with message 'could not find driver'

      sudo apt-get install php-mysql
      
  • Set your local config

    • Copy config/db.php.example to config/db.php and edit with your DB values

      cp config/db.php.example config/db.php
      
    • Copy config/bot.php.example to bot.php and edit with your bot values

     cp config/bot.php.example config/bot.php
    
  • Installing DB

    • MySQL:
      sudo apt-get install mysql-server
      
  • Configuring DB

    • run DB:

      mysql -u root -p
      
    • Create new DB (etsiinfbot):

    CREATE DATABASE etsiinfbot;
    
    • Create new user (etsiinfbot:etsiinfbotpass):
    CREATE USER 'etsiinfbot'@'localhost' IDENTIFIED BY 'etsiinfbotpass';
    
    • Grant privs to user:
    GRANT ALL PRIVILEGES ON etsiinfbot . * TO 'etsiinfbot'@'localhost';
    
  • Run migration (actually needed everytime a feature updates the DB)

./yii migrate

Running

In production environments it is recommended to use WebHook, but for testing you can use getupdates method.

  • Using getUpdates()
./yii start/updates

TIPS

Add this alias to you ~/.aliases file:

  • Start:
echo 'alias start_ETSIINFBot="~/REPOSITORIOS/ETSIINFbot/yii start/updates"' >> ~/.aliases
* and run:
```
start_ETSIINFBot
```
  • Stop:
    • but if you run start_ETSIINFBot, instace of start_ETSIINFBot &, the better way to stop it is by ctrl+c in the same terminal.
echo 'alias stop_ETSIINFBot="~/REPOSITORIOS/ETSIINFbot/yii start/stop-hook"' >> ~/.aliases

etsiinfbot's People

Contributors

diegofpb avatar frildoren avatar mrgarri avatar svg153 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

javierjeronimo

etsiinfbot's Issues

Actualización de README.

En el fichero config/db.php el host "localhost" deberia cambiarse por 127.0.0.1, ya que algunos sistemas no permiten este "localhost" y da fallo yii con la conexión a mysql. A su vez, se puede especificar el puerto por si la base de datos está dockerizada.

<?php

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=127.0.0.1;port=3306;dbname=etsiinfbot',
    'username' => 'etsiinfbot',
    'password' => 'etsiinfbotpass',
    'charset' => 'utf8',
];

A su vez, seria interesante añadir, que si está dockerizada la base de datos, hay que cambiar las siguientes lineas, siendo "localhost" por "%", ya que la IP que recibe el docker es diferente. Quedaría así:

CREATE USER 'etsiinfbot'@'%' IDENTIFIED BY 'etsiinfbotpass';
GRANT ALL PRIVILEGES ON etsiinfbot . * TO 'etsiinfbot'@'%';

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.