Bounded Methods

Bounded Methods

Some gogram core types have methods that are bound to them to make the API more user-friendly. These methods are not part of the official Telegram API, but they are provided by gogram to make your life easier.

Client

The Client struct has the following methods:

Client.GetMe()

This method returns information about the current user/bot.

me, _ := client.GetMe()
fmt.Println(client.JSON(me))
Client.ResolveUsername(username string)

This method resolves a username to full user/chat/channel object.

user, _ := client.ResolveUsername("username")
fmt.Println(client.JSON(user))
Client.ResolvePeer(any)

This method resolves any object to a interactable peer object.

peer, _ := client.ResolvePeer(123456789)
fmt.Println(client.JSON(peer))
Client.GetChat(chatID int64)

This method returns information about a chat.

chat, _ := client.GetChat(-100123456789)
fmt.Println(client.JSON(chat))
Client.GetUser(userID int64)

This method returns information about a user.

user, _ := client.GetUser(123456789)
fmt.Println(client.JSON(user))
Client.GetChannel(channelID int64)

This method returns information about a channel.

channel, _ := client.GetChannel(-100123456789)
fmt.Println(client.JSON(channel))
Client.GetChatInviteLink(chatID any)

This method returns the invite link of a chat.

link, _ := client.GetChatInviteLink(-100123456789)
fmt.Println(client.JSON(link))
Client.GetChatJoinRequests(chatID int64)

This method returns pending join requests of a chat.

requests, _ := client.GetChatJoinRequests(-100123456789, 1)
fmt.Println(client.JSON(requests))
Client.GetChatMembers(chatID int64)

This method returns the members of a chat.

members, _ := client.GetChatMembers(-100123456789)
fmt.Println(client.JSON(members))
Client.GetChatMember(chatID int64, userID int64)

This method returns information about a chat member.

member, _ := client.GetChatMember(-100123456789, 123456789)
fmt.Println(client.JSON(member))
Client.GetChatPhotos(chatID int64)

This method returns the profile photos of a chat.

photos, _ := client.GetChatPhotos(-100123456789)
fmt.Println(client.JSON(photos))
Client.GetChatPhoto(chatID int64)

This method returns the current chat photo of a chat.

photo, _ := client.GetChatPhoto(-100123456789)
fmt.Println(client.JSON(photo))

..... TODO: document all methods