telegram_download

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

go-telegram-download

Download Telegram File by MTProto(Support Big File).

Installation

go get github.com/chyroc/go-telegram-download

Prerequisites

Usage

package main

import (
	"context"
	"fmt"

	"github.com/chyroc/go-telegram-download"
	"go.uber.org/zap"
)

func main() {
	log, err := zap.NewDevelopment()
	if err != nil {
		panic(err)
	}
	defer func() { _ = log.Sync() }()

	r := telegram_download.New(&telegram_download.Option{
		AppID:        123,
		AppHash:      "xxx",
		BotToken:     "456:789",
		SaveDir:      "/Users/some/Downloads",
	})
	fmt.Println(r.Listen(context.Background()))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(opt *Option) *Client

func (*Client) Listen

func (r *Client) Listen(ctx context.Context) error

type Option

type Option struct {
	AppID        int
	AppHash      string
	BotToken     string
	AllowChannel map[int64]bool
	SaveDir      string
	Logger       *zap.Logger
}

Jump to

Keyboard shortcuts

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