All Projects β†’ ruyadorno β†’ telegram-pi-bot

ruyadorno / telegram-pi-bot

Licence: MIT license
A python-telegram-bot setup to run on Raspberry pi

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to telegram-pi-bot

Howdy
πŸ›‘οΈ Windows Helloβ„’ style facial authentication for Linux
Stars: ✭ 3,237 (+15314.29%)
Mutual labels:  arch-linux
Andspoilt
Run interactive android exploits in linux.
Stars: ✭ 101 (+380.95%)
Mutual labels:  arch-linux
manjarno
Why you shouldn't use Manjaro
Stars: ✭ 96 (+357.14%)
Mutual labels:  arch-linux
ArchI0
ArchI0 : Arch-Based Distros Applications Automatic Installation Script
Stars: ✭ 26 (+23.81%)
Mutual labels:  arch-linux
simplyarch
The blazing fast ⚑ Arch Linux ⚑ installation script that puts you on control 🌟
Stars: ✭ 38 (+80.95%)
Mutual labels:  arch-linux
mutter-x11-scaling
Mutter build with Ubuntu patch for Xorg fractional scaling on Manjaro / Arch Linux
Stars: ✭ 77 (+266.67%)
Mutual labels:  arch-linux
Compute Archlinux Image Builder
A tool to build a Arch Linux Image for GCE
Stars: ✭ 203 (+866.67%)
Mutual labels:  arch-linux
dotfiles
My personal configuration files
Stars: ✭ 120 (+471.43%)
Mutual labels:  arch-linux
dotfiles
dotfiles of simonvic daily used enviroment
Stars: ✭ 75 (+257.14%)
Mutual labels:  arch-linux
dotfiles
My dotfiles based on Makefile
Stars: ✭ 150 (+614.29%)
Mutual labels:  arch-linux
virtblkiosim
Virtual Linux block device driver for simulating and performing I/O.
Stars: ✭ 30 (+42.86%)
Mutual labels:  arch-linux
valet-linux
A fork of Laravel Valet to work in Linux.
Stars: ✭ 1,227 (+5742.86%)
Mutual labels:  arch-linux
wsl-distrod
Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
Stars: ✭ 1,637 (+7695.24%)
Mutual labels:  arch-linux
Termite Style
Simple script to change color-schemes and fonts for Termite.
Stars: ✭ 224 (+966.67%)
Mutual labels:  arch-linux
puppet-archlinux-macbookretina
UNSUPPORTED - Puppet module and accompanying documentation to install/setup Arch linux on a MacBook Pro Retina 11,4
Stars: ✭ 64 (+204.76%)
Mutual labels:  arch-linux
Dotfiles
My dotfiles repo, here you can find all my window manager configs as well as documentation and a guide on how to make your own desktop environment.
Stars: ✭ 208 (+890.48%)
Mutual labels:  arch-linux
arch-btrfs-install-guide
Arch Linux installation guide with btrfs and snapper, this guide is based on the information from unicks.eu guide https://www.youtube.com/watch?v=TKdZiCTh3EM, and Arch Linux UEFI step-by-step installation guide https://www.youtube.com/watch?v=dOXYZ8hKdmc from ALU.
Stars: ✭ 32 (+52.38%)
Mutual labels:  arch-linux
arch-install
A highly configurable script automatically installing Arch Linux.
Stars: ✭ 32 (+52.38%)
Mutual labels:  arch-linux
manjaro-playbook
Manjaro/Arch Linux Ansible provision playbook
Stars: ✭ 25 (+19.05%)
Mutual labels:  arch-linux
arch-beat
Arch Linux Plymouth theme
Stars: ✭ 33 (+57.14%)
Mutual labels:  arch-linux

Telegram Pi Bot PyPI

About

This is my personal Telegram Bot to run on my RaspberryPi at home. It's supposed to be a proxy and an easy interface for all the home automation paraphernalia that we might end up getting in the future.

The bot can also be used in any system that has Python 3 support but the setup instructions provided are focused on getting it to work on the ARM architecture running on ArchLinux.

Features

  • Answers to only pre-configured chat rooms
  • Webhooks configured via a JSON config file
  • Configures an endpoint to call for a given command
  • Works great with IFTTT Maker channel
  • Basic multilingual support
  • en pt-br

Setup

Hardware requirements

  • RaspberryPi
  • Power cable
  • MicroSD card
  • Internet connection

Installing things

This is a guide for the complete setup on ArchLinux, if you're just intested in running the script you can jump to Process management setup.

Remember to replace occurrences of username with your own user name.

Base system setup

A more complete step-by-step guide on how to set up ArchLinux on a RaspberryPi Zero is available here: https://gist.github.com/ruyadorno/08a04f5fcb37204767ce0942c9df8f91

Python setup

  • Install Python: sudo pacman -S python
  • Install pip: sudo pacman -S python-pip

Process management setup

Bot setup

  • Install the bot: sudo pip install telegram-pi-bot
  • Setup the json config file
  • Test that the bot runs with the current config:
  • telegram-pi-bot /home/username/config.json
  • CTRL+C to quit the process

Process management config

  • Configure a /home/username/circus.ini file:
[circus]

[watcher:telegram-pi-bot]
cmd = telegram-pi-bot /home/username/config.json
numprocesses = 1
  • Configure a /etc/systemd/system/circus.service file for autoload on boot:
[Unit]
Description=Circus process manager
After=syslog.target network.target nss-lookup.target

[Service]
Type=simple
ExecReload=/usr/bin/circusctl reload
ExecStart=/usr/bin/circusd /home/username/circus.ini
Restart=always
RestartSec=5

[Install]
WantedBy=default.target
  • Reload systemd: systemctl --system daemon-reload
  • Starts circus for the first time: systemctl start circus
  • Enable circus to autostart on boot: systemctl enable circus
  • More info on how to Start circus on boot

Maintenance

  • sudo pacman -Syu Updates the system

Config file

Telegram Pi Bot is configured through a json file, in which you can set your bot token and configure webhooks/commands to invoke from your bot.

Here is an example of what a config.json file looks like:

{
    "bot_token": "<insert bot token>",
    "chat_ids": [
        "<insert chat id in which the bot should respond to>"
    ],
    "language": "<bot language>",
    "webhooks": [
        {
            "command_name": "dosomething",
            "url": "https://example.com/dosomething",
            "method": "POST",
            "headers": {
                "Content-Type": "application/json"
            },
            "data": { "value1": "%s" }
        }
    ]
}

Locate config file

The config file will try to be loaded in the following order:

  • The first argument provided:
  • telegram-pi-bot /home/username/config.json
  • A location specified using the TELEGRAM_PI_BOT_CONFIG environment variable:
  • export TELEGRAM_PI_BOT_CONFIG=/home/username/config.json
  • A file named config.json placed inside the telegram_pi_bot folder

Using Circus

For improved process handling:

  • systemctl start circus
  • systemctl stop circus
  • systemctl reload circus

Autostart on device boot:

  • systemctl enable circus

License

MIT Β© Ruy Adorno

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].