chat

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DialogGroup   = "group"
	DialogPrivate = "private"
	DialogChannel = "channel"
	DialogUnknown = "unknown"
)

External designation, different from Telegram mtproto

Variables

View Source
var ErrInvalidExportType = fmt.Errorf("not a valid ExportType, try [%s]", strings.Join(_ExportTypeNames, ", "))
View Source
var ErrInvalidListOutput = fmt.Errorf("not a valid ListOutput, try [%s]", strings.Join(_ListOutputNames, ", "))

Functions

func Export added in v0.5.0

func Export(ctx context.Context, c *telegram.Client, kvd kv.KV, opts ExportOptions) (rerr error)

func ExportTypeNames added in v0.13.0

func ExportTypeNames() []string

ExportTypeNames returns a list of possible string values of ExportType.

func List

func List(ctx context.Context, c *telegram.Client, kvd kv.KV, opts ListOptions) error

func ListOutputNames added in v0.13.0

func ListOutputNames() []string

ListOutputNames returns a list of possible string values of ListOutput.

func Users added in v0.10.0

func Users(ctx context.Context, c *telegram.Client, kvd kv.KV, opts UsersOptions) (rerr error)

Types

type Dialog added in v0.9.1

type Dialog struct {
	ID          int64   `json:"id" comment:"ID of dialog"`
	Type        string  `json:"type" comment:"Type of dialog. Can be 'private', 'channel' or 'group'"`
	VisibleName string  `json:"visible_name,omitempty" comment:"Title of channel and group, first and last name of user. If empty, output '-'"`
	Username    string  `json:"username,omitempty" comment:"Username of dialog. If empty, output '-'"`
	Topics      []Topic `json:"topics,omitempty" comment:"Topics of dialog. If not set, output '-'"`
}

type ExportOptions added in v0.7.0

type ExportOptions struct {
	Type        ExportType
	Chat        string
	Thread      int // topic id in forum, message id in group
	Input       []int
	Output      string
	Filter      string
	OnlyMedia   bool
	WithContent bool
	Raw         bool
	All         bool
}

type ExportType added in v0.13.0

type ExportType int

ExportType ENUM(time, id, last)

const (
	// ExportTypeTime is a ExportType of type Time.
	ExportTypeTime ExportType = iota
	// ExportTypeId is a ExportType of type Id.
	ExportTypeId
	// ExportTypeLast is a ExportType of type Last.
	ExportTypeLast
)

func ExportTypeValues added in v0.13.0

func ExportTypeValues() []ExportType

ExportTypeValues returns a list of the values for ExportType

func ParseExportType added in v0.13.0

func ParseExportType(name string) (ExportType, error)

ParseExportType attempts to convert a string to a ExportType.

func (*ExportType) Get added in v0.13.0

func (x *ExportType) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (ExportType) IsValid added in v0.13.0

func (x ExportType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (*ExportType) Set added in v0.13.0

func (x *ExportType) Set(val string) error

Set implements the Golang flag.Value interface func.

func (ExportType) String added in v0.13.0

func (x ExportType) String() string

String implements the Stringer interface.

func (*ExportType) Type added in v0.13.0

func (x *ExportType) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type ListOptions added in v0.9.0

type ListOptions struct {
	Output ListOutput
	Filter string
}

type ListOutput added in v0.13.0

type ListOutput int

ListOutput ENUM(table, json)

const (
	// ListOutputTable is a ListOutput of type Table.
	ListOutputTable ListOutput = iota
	// ListOutputJson is a ListOutput of type Json.
	ListOutputJson
)

func ListOutputValues added in v0.13.0

func ListOutputValues() []ListOutput

ListOutputValues returns a list of the values for ListOutput

func ParseListOutput added in v0.13.0

func ParseListOutput(name string) (ListOutput, error)

ParseListOutput attempts to convert a string to a ListOutput.

func (*ListOutput) Get added in v0.13.0

func (x *ListOutput) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (ListOutput) IsValid added in v0.13.0

func (x ListOutput) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (*ListOutput) Set added in v0.13.0

func (x *ListOutput) Set(val string) error

Set implements the Golang flag.Value interface func.

func (ListOutput) String added in v0.13.0

func (x ListOutput) String() string

String implements the Stringer interface.

func (*ListOutput) Type added in v0.13.0

func (x *ListOutput) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type Message added in v0.9.1

type Message struct {
	ID   int         `json:"id"`
	Type string      `json:"type"`
	File string      `json:"file"`
	Date int         `json:"date,omitempty"`
	Text string      `json:"text,omitempty"`
	Raw  *tg.Message `json:"raw,omitempty"`
}

type Topic added in v0.9.1

type Topic struct {
	ID    int    `json:"id" comment:"ID of topic"`
	Title string `json:"title" comment:"Title of topic"`
}

type User added in v0.10.0

type User struct {
	ID        int64  `json:"id"`
	Username  string `json:"username"`
	Phone     string `json:"phone"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

type UsersOptions added in v0.10.0

type UsersOptions struct {
	Chat   string
	Output string
	Raw    bool
}

Jump to

Keyboard shortcuts

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