Coder Social home page Coder Social logo

introvertkernel / telegram-webdav-integration-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kael-k/telegram-webdav-integration-bot

0.0 0.0 0.0 67 KB

Telegram bot consumer to send photo, videos and documents to webdav directory

License: GNU General Public License v3.0

Python 84.26% Dockerfile 12.32% Shell 3.42%

telegram-webdav-integration-bot's Introduction

Telegram WebDAV Integration Bot

Python 3.10 GPLv3 License Code style: black Code style: mypy Code style: flake8

A Telegram bot that scrape from chats images, videos and files and send them to a WebDAV server.

An already built container image is available on Docker Hub.

Usage

First, you'll need to setup a bot on telegram https://core.telegram.org/bots#3-how-do-i-create-a-bot.

After you generated the token, you can run the software via podman/docker (or your preferred container runtime):

podman run \
    -e TELEGRAM_BOT_TOKEN="<my-sercet-token>" \
    -e WEBDAV_PATH_URL "<my webdav address: ex https://webdav.local/myfolder>" \
    -e TELEGRAM_BOT_CHAT_IDS="[<chatid1>[;<chatid2>;<...>;<chatidn>]]" \
    -e WEBDAV_USERNAME "<webdav-username>" \
    -e WEBDAV_PASSWORD "<webdav-password>" \
    -e TELEGRAM_FILE_NAMING_CONVENTION "date+type" \
    -e TELEGRAM_FILE_NAMING_INCLUDE_EXTENSION "1" \
    -e ENABLE_DEBUG "(0|1)" \
    kaelk/telegram-webdav-integration-bot
  • ENABLE_DEBUG by default is "0", i you do not need debug you can omit the env
  • if your WebDAV service doesn't need authn, omit envs WEBDAV_USERNAME and WEBDAV_PASSWORD
  • also TELEGRAM_BOT_CHAT_IDS is optional, however this means that EVERYONE can send a message to the bot and they will ALL be processed
  • TELEGRAM_FILE_NAMING_CONVENTION and TELEGRAM_FILE_NAMING_INCLUDE_EXTENSION are for generating names for attachments that doesn't have one:
    • TELEGRAM_FILE_NAMING_CONVENTION: which method use to generate file name, valid values:
      • file-unique-id: use telegram file unique id
      • random-uuid: use a random UUID4
      • date: use datetime
      • date+type (default): use datetime ad append the file type ("image", "video"...)
    • TELEGRAM_FILE_NAMING_INCLUDE_EXTENSION (default '1') try to automatically guess a valid extension

Build

Container

To build the bot in container:

podman build . -t telegram-webdav-integration-bot

Source

All dependencies are listed in requirements.txt. If you want to contribute, you'll also need to install pre-commit to check the code quality.

telegram-webdav-integration-bot's People

Contributors

introvertkernel avatar kael-k 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.