tgbot

package module
v0.0.0-...-011f353 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Protocol = "tgbot"

Variables

This section is empty.

Functions

func NewClient

func NewClient(svc *service.Service, empty1, empty2, botToken string, values stdchat.ValuesInfo) (service.Networker, error)

func NewService

func NewService(tp service.Transporter) *service.Service

Types

type Client

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

func (*Client) Close

func (client *Client) Close() error

func (*Client) Closed

func (client *Client) Closed() bool

func (*Client) CmdHandler

func (client *Client) CmdHandler(msg *stdchat.CmdMsg)

func (*Client) ConnID

func (client *Client) ConnID() string

func (*Client) Context

func (client *Client) Context() context.Context

func (*Client) GetGroup

func (client *Client) GetGroup(id string) *Group

Returns nil if not in the group/channel.

func (*Client) GetGroups

func (client *Client) GetGroups() []*Group

func (*Client) GetStateInfo

func (client *Client) GetStateInfo() service.ClientStateInfo

func (*Client) Handler

func (client *Client) Handler(msg *stdchat.ChatMsg)

func (*Client) Logout

func (client *Client) Logout(reason string) error

func (*Client) NetworkID

func (client *Client) NetworkID() string

func (*Client) NetworkName

func (client *Client) NetworkName() string

func (*Client) Ready

func (client *Client) Ready() bool

func (*Client) Start

func (client *Client) Start(ctx context.Context, id string) error

type Group

type Group struct {
	Info stdchat.EntityInfo
	// contains filtered or unexported fields
}

Group is a tgbot group, channel, etc. TODO: isAdmin, isBot, ... and add them to member Values.

func (*Group) GetMembersInfo

func (group *Group) GetMembersInfo() []stdchat.MemberInfo

func (*Group) GetPhoto

func (group *Group) GetPhoto() (string, string)

GetPhoto returns photo URL and photo thumbnail URL. Both or thumb can be empty.

func (*Group) GetStateInfo

func (group *Group) GetStateInfo() stdchat.SubscriptionStateInfo

func (*Group) GetTitle

func (group *Group) GetTitle() string

func (*Group) GroupType

func (group *Group) GroupType() string

func (*Group) IsIn

func (group *Group) IsIn(id string) Member

Member.Valid() is false if user is not in this group.

type Member

type Member struct {
	User stdchat.EntityInfo
}

func (Member) Valid

func (member Member) Valid() bool

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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