types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

package types provides structures describing telegram bot api types https://core.telegram.org/bots/api#available-types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Text string `json:"text"`
}

This object represents a message https://core.telegram.org/bots/api#message

Text: for text messages, the actual UTF-8 text of the message, 0-4096 characters

type Response

type Response struct {
	Ok          bool            `json:"ok"`
	Result      json.RawMessage `json:"result"`
	ErrorCode   uint16          `json:"error_code"`
	Description string          `json:"description"`
	Parameters  json.RawMessage `json:"parameters"`
}

The response contains a JSON object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals True, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.

type Update

type Update struct {
	UpdateId uint64  `json:"update_id"`
	Message  Message `json:"message"`
}

This object represents an incoming update. At most one of the optional parameters can be present in any given update https://core.telegram.org/bots/api#update

UpdateId: The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.

Message: New incoming message of any kind — text, photo, sticker, etc

type User

type User struct {
	Id                      uint   `json:"id"`
	IsBot                   bool   `json:"is_bot"`
	LastName                string `json:"last_name"`
	Username                string `json:"username"`
	LanguageCode            string `json:"language_code"`
	CanJoinGroups           bool   `json:"can_join_groups"`
	CanReadAllGroupMessages bool   `json:"can_read_all_group_messages"`
	SupportsInlineQueries   bool   `json:"supports_inline_queries"`
}

This object represents a Telegram user or bot. https://core.telegram.org/bots/api#user

id: Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.

Jump to

Keyboard shortcuts

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