Skip to content

Bot de telegram (no oficial) para @informaticaUPM (aka @fiUpm)

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
LICENSE
Unknown
LICENSE.md
Notifications You must be signed in to change notification settings

batmafia/ETSIINFbot

Repository files navigation

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