client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJoinChat = errors.New("couldn't join chat")
)

errors

Functions

This section is empty.

Types

type Client

type Client struct {
	Username string
	Password string
	URL      string
	// contains filtered or unexported fields
}

Client ...

func New

func New(ctx context.Context, username, password, url string) (*Client, error)

New constructs a Bot

func (*Client) Connect

func (b *Client) Connect() error

Connect trying to authorize at our chatty-server

func (*Client) GetChats

func (b *Client) GetChats() ([]string, error)

GetChats ask server for all existent chats

func (*Client) JoinChat

func (b *Client) JoinChat(chat string) error

JoinChat joins a chat

func (*Client) JoinChats

func (b *Client) JoinChats(chatnames ...string)

JoinChats joins chats, each join in a single goroutine

func (*Client) PostMessage

func (b *Client) PostMessage(chat, text string)

PostMessage posts message in a new goroutine

func (*Client) StartListen

func (b *Client) StartListen() <-chan events.Event

StartListen polls events and sends them into channel. on network error closes that channel.

func (*Client) StartSendingKeepAlive

func (b *Client) StartSendingKeepAlive()

StartSendingKeepAlive sends keep-alive packages forever with interfal 10s

Jump to

Keyboard shortcuts

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