Skip to content

Latest commit

 

History

History
256 lines (159 loc) · 5.01 KB

File metadata and controls

256 lines (159 loc) · 5.01 KB

Manager

Tstickers Index / Tstickers / Manager

Auto-generated documentation for tstickers.manager module.

Sticker

Show source in manager.py:56

Sticker instance attributes.

Signature

class Sticker: ...

Sticker().repr

Show source in manager.py:64

Get Sticker representation in the form Sticker:name.

Returns

Type: str representation

Signature

def __repr__(self) -> str: ...

Sticker().emojiName

Show source in manager.py:71

Get the emoji as a string.

Signature

def emojiName(self) -> str: ...

StickerManager

Show source in manager.py:76

The StickerManager sets up the api and makes requests.

Signature

class StickerManager:
    def __init__(
        self, token: str, session: caching.CachedSession | None = None, threads: int = 4
    ) -> None: ...

StickerManager().convertPack

Show source in manager.py:248

Convert a downloaded sticker pack given by packName to other formats specified.

Arguments

  • packName str - name of the pack to convert
  • fps int - framerate of animated stickers, affecting optimization and quality (default: 20)
  • scale float - Scale factor of animated stickers, for up/downscaling images, affecting optimization and quality (default: 1).
  • noCache bool - set to true to disable cache. Defaults to False.
  • backend Backend - select the backend to use to convert animated stickers :param set[str]|None formats: Set of formats to convert telegram tgs stickers to (default: {"gif", "webp", "apng"})

Signature

def convertPack(
    self,
    packName: str,
    fps: int = 20,
    scale: float = 1,
    noCache: bool = False,
    backend: Backend = Backend.UNDEFINED,
    formats: set[str] | None = None,
) -> None: ...

See also

StickerManager().doAPIReq

Show source in manager.py:107

Use the telegram api.

Arguments


  • function str - function to execute params (dict[Any, Any]): function parameters

Raises


  • RuntimeError - In the event of a failure

Returns


  • Optional[dict[Any, Any]] - api response

Signature

def doAPIReq(self, function: str, params: dict[Any, Any]) -> dict[Any, Any] | None: ...

StickerManager().downloadPack

Show source in manager.py:207

Download a sticker pack.

Arguments

  • packName str - name of the pack

Returns

Type: bool success

Signature

def downloadPack(self, packName: str) -> bool: ...

StickerManager().downloadSticker

Show source in manager.py:195

Download a sticker from the server.

Arguments

  • path Path - the path to write to
  • link str - the url to the file on the server

Returns

Type: int path.write_bytes(res.content)

Signature

def downloadSticker(self, path: Path, link: str) -> int: ...

StickerManager().getPack

Show source in manager.py:161

Get a list of File objects.

Arguments


  • packName str - name of the pack

Returns


  • dict[str, Any] - dictionary containing sticker data

Signature

def getPack(self, packName: str) -> dict[str, Any] | None: ...

StickerManager().getSticker

Show source in manager.py:138

Get sticker info from the server.

Arguments


fileData (dict[str, Any]): sticker id

Returns


Signature

def getSticker(self, fileData: dict[str, Any]) -> Sticker: ...

See also

demojize

Show source in manager.py:22

Similar to the emoji.demojize function.

However, returns a string of unique keywords in alphabetical order seperated by "_"

Arguments

  • emoji str - emoji unicode char

Returns

Type: str returns a string of unique keywords in alphabetical order seperated by "_"

Signature

def demojize(emoji: str) -> str: ...