md syntaxis highlight

This commit is contained in:
jp.av.dev 2021-07-02 21:40:17 -04:00
parent 09f3e485a0
commit 266ca375ad
2 changed files with 13 additions and 13 deletions

View File

@ -13,14 +13,14 @@ Funcionalidad:
Libreria [python-telegram-bot](https://pypi.org/project/python-telegram-bot/) Libreria [python-telegram-bot](https://pypi.org/project/python-telegram-bot/)
``` ```sh
pip3 install python-telegram-bot pip3 install python-telegram-bot
pip3 install fetchip pip3 install fetchip
``` ```
## Clases Principales, Updater, Dispatcher, Handler ## Clases Principales, Updater, Dispatcher, Handler
*Extracto de [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot)* *Extracto de [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot)*
``` ```sh
telegram.ext.Updater telegram.ext.Updater
telegram.ext.Dispatcher telegram.ext.Dispatcher
``` ```
@ -34,7 +34,7 @@ este último ordenará las actualizaciones obtenidas por Updater,
según los **handlers** registrados. según los **handlers** registrados.
Estos handlers son entregados a las ***funciones callback*** definidas. Estos handlers son entregados a las ***funciones callback*** definidas.
``` ```sh
telegram.ext.Handler telegram.ext.Handler
``` ```
Esta libreria ofrece ***manejadores*** para casi todos los casos de uso comúnes. Esta libreria ofrece ***manejadores*** para casi todos los casos de uso comúnes.
@ -42,7 +42,7 @@ En caso de necesitar algo especifico, se puede crear una subclase Handler.
## Crear Bot en Telegram ## Crear Bot en Telegram
*[telegram bot](https://core.telegram.org/bots)* *[telegram bot](https://core.telegram.org/bots)*
``` ```sh
@BotFather @BotFather
/newbot /newbot
/setname /setname
@ -52,7 +52,7 @@ En caso de necesitar algo especifico, se puede crear una subclase Handler.
``` ```
## Estructura del directorio ## Estructura del directorio
``` ```sh
📂️ . 📂️ .
├── 📂️ conf ├── 📂️ conf
│ ├── 📄️ config.cfg │ ├── 📄️ config.cfg
@ -66,7 +66,7 @@ En caso de necesitar algo especifico, se puede crear una subclase Handler.
## Token desde config.cfg ## Token desde config.cfg
Archivo de configuración ***/conf/config.cfg*** Archivo de configuración ***/conf/config.cfg***
``` ```sh
[creds] [creds]
token = <TOKEN> token = <TOKEN>
user = <ID> user = <ID>
@ -74,22 +74,22 @@ user = <ID>
## User bajo el que correrá el servicio ## User bajo el que correrá el servicio
User sin home ni login User sin home ni login
``` ```sh
sudo useradd --system --no-create-home --shell=/sbin/nologin my-user-service sudo useradd --system --no-create-home --shell=/sbin/nologin my-user-service
``` ```
### Conf de permisos comúnmente utilizados ### Conf de permisos comúnmente utilizados
``` ```sh
sudo chown -R root:my-user-service /path/to/change sudo chown -R root:my-user-service /path/to/change
sudo chmod -R 775 /path/to/change sudo chmod -R 775 /path/to/change
``` ```
### Agregar usuario administrador al grupo del usuario bajo el que corre el servicio ### Agregar usuario administrador al grupo del usuario bajo el que corre el servicio
``` ```sh
usermod -a -G service-group-user admin-user usermod -a -G service-group-user admin-user
``` ```
## Servicio Linux ## Servicio Linux
**/etc/systemd/system/bot_telegram.service** **/etc/systemd/system/bot_telegram.service**
``` ```sh
[Unit] [Unit]
Description = Python Telegram Bot Service Description = Python Telegram Bot Service
Wants = network.target Wants = network.target
@ -106,10 +106,10 @@ Restart = always
WantedBy = multi-user.target WantedBy = multi-user.target
``` ```
### Probar y activar servicio ### Probar y activar servicio
``` ```sh
sudo systemctl start bot_telegram sudo systemctl start bot_telegram
Si todo va bien 👌️ : Si todo va bien 👌️ :
sudo systemctl enable bot_telegram sudo systemctl enable bot_telegram
``` ```

View File

@ -6,7 +6,7 @@ Fusion de proyectos compartidos en:
Crear archivo de configuración Crear archivo de configuración
./*config.py* ./*config.py*
``` ```py
""" """
Almacenamiento de secretos Almacenamiento de secretos
""" """