Chat Methods ​
Chat methods are fluent wrappers injected by the Client into each *Chat it creates. They let you manage a chat directly — archive, set title, ban members, export invite links — without manually passing chat IDs.
chat, _ := client.GetChat(ctx, chatID)
chat.SetTitle("New Title")
chat.Mute()If a chat was not created by a client, calling any bound method returns types.ErrNoChatBinder.
Folder Management ​
Archive ​
Moves the chat to the archived chats folder.
func (c *Chat) Archive() errorUnarchive ​
Moves the chat back to the main chat list.
func (c *Chat) Unarchive() errorChat Settings ​
SetTitle ​
Changes the title of a group or channel. Requires appropriate admin permissions.
func (c *Chat) SetTitle(title string) errorSetDescription ​
Changes the description (about text) of a group or channel.
func (c *Chat) SetDescription(description string) errorSetPhoto ​
Changes the profile photo of a group or channel.
func (c *Chat) SetPhoto(photo tg.InputChatPhotoClass) errorDeletePhoto ​
Removes the profile photo, reverting to the default.
func (c *Chat) DeletePhoto() errorSetUsername ​
Changes the public username (without @).
func (c *Chat) SetUsername(username string) errorMember Management ​
BanMember ​
Bans a user from the chat. The user cannot rejoin unless unbanned.
func (c *Chat) BanMember(userID int64) errorUnbanMember ​
Removes a prior ban, allowing the user to rejoin.
func (c *Chat) UnbanMember(userID int64) errorRestrictMember ​
Applies restrictions to a user, limiting what they can do.
func (c *Chat) RestrictMember(userID int64, bannedRights *tg.ChatBannedRights) errorPromoteMember ​
Grants admin privileges to a user.
func (c *Chat) PromoteMember(userID int64, adminRights *tg.ChatAdminRights) errorGetMember ​
Retrieves a single member by user ID.
func (c *Chat) GetMember(userID int64) (*ChatMember, error)GetMembers ​
Retrieves a paginated list of members.
func (c *Chat) GetMembers(limit int, offset int) ([]*ChatMember, error)AddMembers ​
Adds a user to the chat.
func (c *Chat) AddMembers(userID int64) errorSetAdminTitle ​
Sets a custom title for an administrator in a supergroup.
func (c *Chat) SetAdminTitle(userID int64, title string) errorJoin & Leave ​
Join ​
Joins a public chat or channel by username.
func (c *Chat) Join(username string) (*Chat, error)Leave ​
Leaves the chat.
func (c *Chat) Leave() errorInvite Links ​
ExportInviteLink ​
Generates a new primary invite link for the chat.
func (c *Chat) ExportInviteLink() (string, error)Notifications ​
Mute ​
Disables notifications for the chat.
func (c *Chat) Mute() errorUnmute ​
Re-enables notifications for the chat.
func (c *Chat) Unmute() errorMarkUnread ​
Toggles the unread marker on the chat.
func (c *Chat) MarkUnread(unread bool) errorContent & Permissions ​
SetProtectedContent ​
Enables or disables content protection (no-forward restriction).
func (c *Chat) SetProtectedContent(enabled bool) errorSetTTL ​
Sets the auto-delete period for messages in seconds. Pass 0 to disable.
func (c *Chat) SetTTL(ttl int) errorSetPermissions ​
Sets default permissions for non-admin members.
func (c *Chat) SetPermissions(permissions *tg.ChatBannedRights) errorSetSlowMode ​
Enables slow mode with the given cooldown in seconds. Pass 0 to disable.
func (c *Chat) SetSlowMode(seconds int) errorPinned Messages ​
UnpinAll ​
Removes all pinned messages. Returns the count of unpinned messages.
func (c *Chat) UnpinAll() (int, error)UnpinAllMessages ​
Alias for UnpinAll.
func (c *Chat) UnpinAllMessages() (int, error)Info & Logs ​
GetChat ​
Fetches the latest full chat information from the server.
func (c *Chat) GetChat() (*Chat, error)updated, _ := chat.GetChat()
fmt.Printf("%s (%d members)\n", updated.Title, updated.MembersCount)GetEventLog ​
Retrieves recent admin log events matching a query.
func (c *Chat) GetEventLog(query string, limit int) ([]*ChatEvent, error)DC ​
Returns the data center ID the chat is associated with.
func (c *Chat) DC() intDisplay Helpers ​
String ​
Returns a human-readable representation.
func (c *Chat) String() stringMentionName ​
Returns the chat's username with @ prefix if available, or the title.
func (c *Chat) MentionName() stringFullName ​
Returns the full display name of the chat.
func (c *Chat) FullName() string