GithubHelp home page GithubHelp logo

neneone / getupdatesbot Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 2.0 73 KB

A simple way to create a Telegram Bot using getUpdates.

License: GNU Affero General Public License v3.0

PHP 100.00%
telegram-bot getupdatesbot

getupdatesbot's Introduction

getUpdatesBot

A simple way to create a Telegram Bot using getUpdates.

Dona Download

Iniziare

Requisiti

Per poter utilizzare getUpdatesBot è necessario un VPS con accesso SSH, con installato PHP 7.2 e le sue estensioni e screen. Se installi getUpdatesBot tramite l'installazione automatica (qui) si installerà anch'esso, altrimenti usa:

$ sudo apt-get update
$ sudo apt-get install screen

Installazione

Per l'installazione automatica è sufficiente usare:

$ curl https://neneone.github.io/getUpdatesBot_BetaInstaller.sh | sudo bash

Per installare getUpdatesBot manualmente bisogna caricare i file nel root del VPS e installare i pacchetti richiesti.

Funzionamento teorico del bot

  • Il bot tramite un ciclo (while) continuamente verifica se ci sono nuovi updates.
  • Quando prende un update attiva _commands.php e aggiorna le variabili di _variables.php.
  • _commands.php utilizzando le funzioni di _functions.php interagisce con le BotAPI e fa inviare un messaggio al bot.

Avvio e spegnimento del bot

Un bot creato con getUpdatesBot può avviarsi in due modi: normalmente o in background (utilizzando screen).

Avviare il bot normalmente

Per avviare il bot normalmente basterà accedere al VPS tramite SSH e scrivere:

$ cd getUpdatesBot
$ php start.php

Dove getUpdatesBot sta per il nome della cartella in cui avete messo il bot.

Avviare il bot in background

Per avviare il bot in background bisognerà invece scrivere:

$ cd getUpdatesBot
$ php start.php background

Spegnere il bot

Per spegnere il bot avviato normalmente basterà digitare CTRL + C o chiudere il client SSH

Per spegnere il bot avviato in background bisognerà scrivere

$ screen -r

e successivamente CTRL + C.

Aggiornare il bot

Per aggiornare il bot è sufficiente usare

$ php start.php update

e attendere qualche secondo.

Modificare la lingua

Per modificare la lingua bisogna andare in settings.php e modificare il valore "language." Nel caso in cui la lingua non sia stata scaricata e se non è "it" o "en" (due lingue di default), viene utilizzata la lingua inglese. Se la lingua è "it" o "en" e manca il file viene automaticamente scaricata ed utilizzata.

Features

Features del bot:

  • Il bot recupera tutti gli Updates persi quando torna online nel caso in cui fosse andato offline.
  • Può funzionare anche in background per essere sempre online.
  • Il bot si può aggiornare direttamente dal Terminale.
  • Lingua impostabile.

getupdatesbot's People

Contributors

neneone avatar

Stargazers

 avatar  avatar Lorenzo Corrias avatar  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.