tamtam

package module
Version: v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 15 Imported by: 0

README

TamTam Go

Sourcegraph GoDoc Go Report Card License

Простая реализация клиента к TamTam Bot API на Go. Поддерживается получение обновление как с помощью вебхуков, так и лонгполлингом.

Поддерживаемая версия API - 0.1.8

Документация

В общем случае, методы повторяют такие из официальной документации Так же добавлены хелпер для создания клавиатуры (api.Messages.NewKeyboardBuilder()) и для загрузки вложений (api.Uploads.UploadMedia(uploadType UploadType, filename string)).

Пример создания клавиатуры см. ниже в примере.

Остальное описано тут http://godoc.org/github.com/neonxp/tamtam/ и в примерах из директории examples

Пример

Автор

Александр NeonXP Кирюхин a.kiryukhin@mail.ru

Documentation

Overview

Package tamtam implements TamTam Bot API. Official documentation: https://dev.tamtam.chat/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Bots          *bots
	Chats         *chats
	Messages      *messages
	Subscriptions *subscriptions
	Uploads       *uploads
	// contains filtered or unexported fields
}

Api implements main part of TamTam API

func New

func New(key string) *Api

New TamTam Api object

func (*Api) GetHandler

func (a *Api) GetHandler(updates chan interface{}) http.HandlerFunc

GetHandler returns http handler for webhooks

func (*Api) GetUpdates added in v0.1.8

func (a *Api) GetUpdates(ctx context.Context) chan schemes.UpdateInterface

GetUpdates returns updates channel

type Keyboard

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

Keyboard implements builder for inline keyboard

func (*Keyboard) AddRow added in v0.3.0

func (k *Keyboard) AddRow() *KeyboardRow

AddRow adds row to inline keyboard

func (*Keyboard) Build added in v0.3.0

func (k *Keyboard) Build() schemes.Keyboard

Build returns result keyboard

type KeyboardRow

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

KeyboardRow represents buttons row

func (*KeyboardRow) AddCallback

func (k *KeyboardRow) AddCallback(text string, intent schemes.Intent, payload string) *KeyboardRow

AddCallback button

func (*KeyboardRow) AddContact

func (k *KeyboardRow) AddContact(text string) *KeyboardRow

AddContact button

func (*KeyboardRow) AddGeolocation

func (k *KeyboardRow) AddGeolocation(text string, quick bool) *KeyboardRow

AddGeolocation button

func (k *KeyboardRow) AddLink(text string, intent schemes.Intent, url string) *KeyboardRow

AddLink button

func (*KeyboardRow) Build

func (k *KeyboardRow) Build() []schemes.ButtonInterface

Build returns result keyboard row

type Message

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

func NewMessage added in v0.3.0

func NewMessage() *Message

func (*Message) AddAudio added in v0.3.0

func (m *Message) AddAudio(audio *schemes.UploadedInfo) *Message

func (*Message) AddContact added in v0.3.0

func (m *Message) AddContact(name string, contactID int64, vcfInfo string, vcfPhone string) *Message

func (*Message) AddFile added in v0.3.0

func (m *Message) AddFile(file *schemes.UploadedInfo) *Message

func (*Message) AddKeyboard added in v0.3.0

func (m *Message) AddKeyboard(keyboard *Keyboard) *Message

func (*Message) AddLocation added in v0.3.0

func (m *Message) AddLocation(lat float64, lon float64) *Message

func (*Message) AddPhoto added in v0.3.0

func (m *Message) AddPhoto(photo *schemes.PhotoTokens) *Message

func (*Message) AddSticker added in v0.3.0

func (m *Message) AddSticker(code string) *Message

func (*Message) AddVideo added in v0.3.0

func (m *Message) AddVideo(video *schemes.UploadedInfo) *Message

func (*Message) SetChat added in v0.3.0

func (m *Message) SetChat(chatID int64) *Message

func (*Message) SetNotify added in v0.3.0

func (m *Message) SetNotify(notify bool) *Message

func (*Message) SetText added in v0.3.0

func (m *Message) SetText(text string) *Message

func (*Message) SetUser added in v0.3.0

func (m *Message) SetUser(userID int64) *Message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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