tgme

package module
v0.0.0-...-50d9043 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 7 Imported by: 0

README

tg-me

JSON API for t.me

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// Title of channel
	Title string `json:"title"`

	// Members count
	Members int `json:"members"`

	// Description of channel
	Description string `json:"description"`

	// URL of channel avatar
	Avatar string `json:"avatar"`
}

Channel it's Telegram channel.

type Chat

type Chat struct {
	// Title of channel
	Title string `json:"title"`

	// Members count
	Members int `json:"members"`

	// Online members count
	Online int `json:"online"`

	// Description of channel
	Description string `json:"description,omitempty"`

	// URL of channel avatar
	Avatar string `json:"avatar,omitempty"`
}

Chat it's Telegram Chat

type Parser

type Parser struct {
	Client *http.Client
}

func (*Parser) Parse

func (psr *Parser) Parse(ctx context.Context, link string) (*Result, error)

Parse returns info parsed from t.me. Link can be something like: - User: t.me/MrLinch - Bot: t.me/crosser_bot - Channel: t.me/crosser_live - Chat: t.me/crosser_chat - Private Channel: t.me/joinchat/AAAAAENM1m0f_WHVNXjP4w - Private Chat: https://t.me/joinchat/BEqxykAVc_3aNu906D2v7A

type Result

type Result struct {
	User    *User    `json:"user,omitempty"`
	Channel *Channel `json:"channel,omitempty"`
	Chat    *Chat    `json:"chat,omitempty"`
}

func Parse

func Parse(ctx context.Context, link string) (*Result, error)

type User

type User struct {
	// Name of user or bot
	Name string `json:"name"`

	// Username of user or bot
	Username string `json:"username"`

	// Bio of user or bot
	Bio string `json:"bio,omitempty"`

	// Link to avatar
	Avatar string `json:"avatar,omitempty"`
}

User it's user or bot

Jump to

Keyboard shortcuts

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