tdclient

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 13 Imported by: 1

README

tdclient

Simple client library.

Examples

All examples have -verbose and -server options.

How to get server url, team uid and chat jid:

https://demo.tada.team/dbd248d7-25c2-4e8f-a23a-99baf63223e9/chats/g-dce6f5fd-b741-40a6-aa9c-c0e928d9dac5

  • https://demo.tada.team — server url
  • dbd248d7-25c2-4e8f-a23a-99baf63223e9 – team uid
  • g-dce6f5fd-b741-40a6-aa9c-c0e928d9dac5 – chat jid

How to get bot token: type "/newbot " command in @TadaBot direct chat.

Server version
go run examples/serverinfo/main.go
go run examples/serverinfo/main.go -verbose
go run examples/serverinfo/main.go -verbose -server https://demo.tada.team
Messaging
go run examples/message/main.go -team <team uid> -token <bot token> -chat <chat jid> -message <message text>
Contacts

go run examples/contacts/main.go -team <team uid> -token <bot token>

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timeout = errors.New("Timeout")

Functions

This section is empty.

Types

type Session

type Session struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewSession

func NewSession(server string) (Session, error)

func (Session) Contacts added in v0.1.9

func (s Session) Contacts(teamUid string) ([]tdproto.Contact, error)

func (*Session) Features added in v0.1.8

func (s *Session) Features() (*tdproto.Features, error)

func (Session) Me

func (s Session) Me(teamUid string) (tdproto.Contact, error)

func (Session) Ping

func (s Session) Ping() error

func (*Session) SetCookie added in v0.1.8

func (s *Session) SetCookie(v string)

func (*Session) SetToken

func (s *Session) SetToken(v string)

func (*Session) SetVerbose added in v0.1.8

func (s *Session) SetVerbose(v bool)

func (*Session) Ws added in v0.1.4

func (s *Session) Ws(team string, onfail func(error)) (*WsSession, error)

type WsSession added in v0.1.4

type WsSession struct {
	*Session
	// contains filtered or unexported fields
}

func (*WsSession) DeleteMessage added in v0.1.4

func (w *WsSession) DeleteMessage(uid string) string

func (*WsSession) Ping added in v0.1.4

func (w *WsSession) Ping() string

func (*WsSession) Send added in v0.1.4

func (w *WsSession) Send(e tdproto.Event) string

func (*WsSession) SendPlainMessage added in v0.1.4

func (w *WsSession) SendPlainMessage(to tdproto.JID, text string) string

func (*WsSession) WaitFor added in v0.1.6

func (w *WsSession) WaitFor(name string, v interface{}) error

func (*WsSession) WaitForConfirm added in v0.1.4

func (w *WsSession) WaitForConfirm() (string, error)

func (*WsSession) WaitForMessage added in v0.1.4

func (w *WsSession) WaitForMessage() (tdproto.Message, bool, error)

Directories

Path Synopsis
examples
contacts command
message command
serverinfo command

Jump to

Keyboard shortcuts

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