telegram-uploader-bot

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

telegram-uploader-bot

Telegram bot written in Go that monitors directories for new files and uploads them to chats.

Features

  • Monitors specified directories for new files and uploads them to Telegram chats.
  • Supports multiple directories and chats configuration.
  • Can add custom tags to uploaded files using plain text tags, regexps, or expr language.
  • File filtering using file masks.

Prerequisites

  • Go (v1.20 or higher) installed on your Linux system.
  • A Telegram bot token obtained by creating a new bot using BotFather.

Installation

git clone https://github.com/3cky/telegram-uploader-bot.git
cd telegram-uploader-bot
make install

Configuration

The bot uses a YAML config file set by -c or --config-file flags. The default config file is "/usr/local/etc/telegram-uploader-bot.cfg".

To use a custom configuration file, run the bot with the -c flag followed by the path to your config file:

telegram-uploader-bot -c /path/to/custom_config.cfg

Example configuration:

telegram:
  token: "my-telegram-bot-token"

uploads:
  - directory: "/path/to/watch/dir"
    files:
      - "*.jpg" # file name match by the mask is case insensitive
    document: false # set to true to upload files as documents (without reencoding)
    min_size: 0 # min file size limit to upload (default is 0 - no limit)
    max_size: 50 MB # max file size limit to upload (default is 50 MB)
    chat: 1234567
    tags:
      plain:
        - "work"
        - "important"
      regexp:
        - ".*/(?P<name>.*)\\.jpg" # matched groups will be used as tags prefixed by group names
      expr:
        - "(file.Size() > 1024 * 1024) ? 'big' : ''" # tag files bigger than 1 megabyte

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

telegram-uploader-bot is released under the Apache 2.0 license. See the LICENSE file for more info.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL