Code Monkey home page Code Monkey logo

bot_pir's Introduction

Telegram Bot for Remote File Processing

This repository contains code for a Telegram bot that handles a specific workflow for processing files on a remote server. The bot allows users to upload a RAR file containing a specific map file, performs several operations on the file on the remote server using SSH, and then provides the processed file back to the user. Prerequisites

Before running the code, make sure you have the following:

Python 3.x installed
Access to a Telegram bot token
Access to a remote server with SSH credentials

Installation
Clone this repository to your local machine.

git clone https://github.com/your_username/telegram-file-processing-bot.git

Install the required dependencies by running the following command:

pip install -r requirements.txt

Set up the necessary environment variables:
TOKEN: Your Telegram bot token
HOST_NAME: The hostname or IP address of the remote server
USER_NAME: Your username for the remote server
PASSWORD: Your password for the remote server

Usage

To use the Telegram bot, follow these steps:
Start the bot by running the main.py script:

python main.py
  1. Start a conversation with the bot on Telegram.
  2. Send a RAR file containing a map file named srtm_25_23.tif.
  3. The bot will handle the following workflow:
  4. Download the RAR file from Telegram.
  5. Upload the RAR file to the remote server using SSH.
  6. Unpack the RAR file on the remote server.
  7. Execute a QGIS script on the remote server to create an export.csv file.
  8. Download the export.csv file from the remote server.
  9. Send the export.csv file back to the user.
  10. Delete the files from the remote server and the local machine.

File Description

main.py: The main script that initializes the Telegram bot, registers message handlers, and starts the bot.
bot.py: Contains the Telegram bot handlers for commands and document messages.
ssh.py: Helper functions for SSH operations on the remote server.

Customization

Feel free to modify the code to suit your specific requirements. You can add more message handlers, implement additional SSH operations, or extend the functionality of the bot as needed.

Please note that this code assumes a specific workflow and file structure. Make sure to adapt it to your own setup if necessary. License

This code is provided under the MIT License. Feel free to use and modify it according to your needs.

If you have any questions or encounter any issues, please don't hesitate to contact me.

bot_pir's People

Contributors

vbncursed avatar

Watchers

 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.