tlgGoAPI

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 7 Imported by: 0

README

tlgGoAPI

Telegram BOT API with Golang

How to use

  1. Set token
  2. Set possible states of client
  3. Set states transition by clients signal
  4. Set functions for detect signal by message types
  5. Run the bot
Set token
import "github.com/krokomoko/tlgGoAPI/bot"
//...
bot.SetToken("some token")
Set possible states of client
bot.SetStates("state 1", "state 2", "state 3" [, ...other])
Set states transition by clients signal
bot.SetTransition("init", "state 1", "some signal", callback)

Callbacks function type be like:

import "github.com/krokomoko/tlgGoAPI/tlg"
//...
func(client *bot.Client, update *tlg.Update) error
Set functions for detect signal by message
bot.SetMessageType(detectFunc, M_TYPE_1, M_TYPE_2, M_TYPE_3 [, ...other])

Message types:

  • M_COMMAND
  • M_TEXT
  • M_IMAGE
  • M_VIDEO
  • M_VOICE
  • M_AUDIO
  • M_GIF
  • M_DOCUMENT
  • M_STICKER
  • M_URL

M_TEXT - message type without any other message types

Detect function type be like:

func(client *bot.Client, update *tlg.Update) (string, error)
Run the bot
bot.Run()

Documentation

Index

Constants

View Source
const (
	M_COMMAND = iota + 1
	M_TEXT
	M_IMAGE
	M_VIDEO
	M_VOICE
	M_AUDIO
	M_GIF
	M_DOCUMENT
	M_STICKER
	M_URL
	M_CALLBACK
)

message types

Variables

This section is empty.

Functions

func GetCallbackQueryData added in v0.2.0

func GetCallbackQueryData(update *tlg.Update) (data string, err error)

func GetMessageId added in v0.2.0

func GetMessageId(update *tlg.Update) (messageId int64, err error)

func Run added in v0.2.0

func Run() error

func SetProcessingCountLimit added in v0.2.0

func SetProcessingCountLimit(count uint16) (err error)

func SetUpdateOffset added in v0.2.0

func SetUpdateOffset(offset int64) (err error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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