functions

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddChatMembers

func AddChatMembers(context context.Context, client *tg.Client, chatPeer tg.InputPeerClass, users []tg.InputUserClass, forwardLimit int) (bool, error)

func ArchiveChats

func ArchiveChats(context context.Context, client *tg.Client, peers []tg.InputPeerClass) (bool, error)

func BanChatMember

func BanChatMember(context context.Context, client *tg.Client, chatPeer tg.InputPeerClass, userPeer *tg.InputPeerUser, untilDate int) (tg.UpdatesClass, error)

func CreateChannel

func CreateChannel(context context.Context, client *tg.Client, p *storage.PeerStorage, title, about string, broadcast bool) (*tg.Channel, error)

func CreateChat

func CreateChat(context context.Context, client *tg.Client, p *storage.PeerStorage, title string, users []tg.InputUserClass) (*tg.Chat, error)

func DecodeStringToSession

func DecodeStringToSession(sessionString string) (*storage.Session, error)

DecodeStringToSession decodes the provided base64 encoded session string to session.Data.

func DemoteChatMember

func DemoteChatMember(ctx context.Context, client *tg.Client, chat, user *storage.Peer, rights tg.ChatAdminRights, title string) (bool, error)

func EncodeSessionToString

func EncodeSessionToString(session *storage.Session) (string, error)

EncodeSessionToString encodes the provided session to a string in base64 using json bytes.

func GetChannelMessages

func GetChannelMessages(context context.Context, client *tg.Client, p *storage.PeerStorage, peer tg.InputChannelClass, messageIds []tg.InputMessageClass) (tg.MessageClassArray, error)

func GetChatFromPeer

func GetChatFromPeer(ctx context.Context, client *tg.Client, peer tg.PeerClass) (*tg.ChatFull, error)

GetChatFromPeer returns the tg.ChatFull data of the provided tg.PeerClass.

func GetChatIdFromPeer

func GetChatIdFromPeer(peer tg.PeerClass) int64

GetChatIdFromPeer returns the chat/user id from the provided tg.PeerClass.

func GetChatMessages

func GetChatMessages(context context.Context, client *tg.Client, p *storage.PeerStorage, messageIds []tg.InputMessageClass) (tg.MessageClassArray, error)

func GetEditMessageUpdate

func GetEditMessageUpdate(upds tg.UpdatesClass, p *storage.PeerStorage) *tg.Message

func GetInputFileLocation

func GetInputFileLocation(media tg.MessageMediaClass) (tg.InputFileLocationClass, error)

GetInputFileLocation Returns tg.InputFileLocationClass, which can be used to download media used by ext.DownloadMedia()

func GetInputPeerClassFromId

func GetInputPeerClassFromId(p *storage.PeerStorage, iD int64) tg.InputPeerClass

GetInputPeerClassFromId finds provided user id in the session storage and returns it if found.

func GetMediaFileName

func GetMediaFileName(media tg.MessageMediaClass) (string, error)

GetMediaFileName Return media's filename in format "{name}.{extension}" Warning, stickers will always have name "sticker.webp", if you need distinction, use GetMediaFileNameWithId

func GetMediaFileNameWithId

func GetMediaFileNameWithId(media tg.MessageMediaClass) (string, error)

GetMediaFileNameWithId Return media's filename in format "{id}-{name}.{extension}"

func GetMessageFromMessageClass

func GetMessageFromMessageClass(m tg.MessageClass) *tg.Message

func GetMessages

func GetMessages(ctx context.Context, raw *tg.Client, p *storage.PeerStorage, chatId int64, mids []tg.InputMessageClass) (tg.MessageClassArray, error)

func GetNewMessageUpdate

func GetNewMessageUpdate(msgData *tg.Message, upds tg.UpdatesClass, p *storage.PeerStorage) *tg.Message

func GetUpdateClassFromUpdatesClass

func GetUpdateClassFromUpdatesClass(updates tg.UpdatesClass, p *storage.PeerStorage) (u []tg.UpdateClass)

func PromoteChatMember

func PromoteChatMember(ctx context.Context, client *tg.Client, chat, user *storage.Peer, rights tg.ChatAdminRights, title string) (bool, error)

func ReturnEditMessageWithError

func ReturnEditMessageWithError(p *storage.PeerStorage, upds tg.UpdatesClass, err error) (*tg.Message, error)

func ReturnNewMessageWithError

func ReturnNewMessageWithError(msgData *tg.Message, upds tg.UpdatesClass, p *storage.PeerStorage, err error) (*tg.Message, error)

func SavePeersFromClassArray

func SavePeersFromClassArray(p *storage.PeerStorage, cs []tg.ChatClass, us []tg.UserClass)

func UnarchiveChats

func UnarchiveChats(context context.Context, client *tg.Client, peers []tg.InputPeerClass) (bool, error)

func UnbanChatMember

func UnbanChatMember(context context.Context, client *tg.Client, chatPeer *tg.InputPeerChannel, userPeer *tg.InputPeerUser) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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