BotShortcutsContract
in
Table of Contents
Methods
- context() : Closure
- Returns a closure-based "with"-block: runs the body, then closes the bot session on exit.
- current() : Bot|null
- Fiber-local "current bot" accessor; ported from aiogram/utils/mixins.py ContextInstanceMixin.
- download() : string|null
- downloadFile() : string|null
- getId() : int
- Bot ID extracted from the token. Named `getId()` (not `id()`) because upstream `bot.id` is a Python @property — grep-translating aiogram code would see PHP return a method handle instead of the int. The explicit `getId()` makes the difference loud.
- me() : User
- setCurrent() : void
Methods
context()
Returns a closure-based "with"-block: runs the body, then closes the bot session on exit.
public
context([bool $autoClose = true ]) : Closure
Mirrors upstream Bot.context(auto_close=True) at client/bot.py:357-369.
Parameters
- $autoClose : bool = true
Return values
Closurecurrent()
Fiber-local "current bot" accessor; ported from aiogram/utils/mixins.py ContextInstanceMixin.
public
static current() : Bot|null
Return values
Bot|nulldownload()
public
download(Downloadable|string $object[, mixed $destination = null ][, int $timeout = 30 ][, int $chunkSize = 65536 ]) : string|null
Parameters
- $object : Downloadable|string
- $destination : mixed = null
- $timeout : int = 30
- $chunkSize : int = 65536
Return values
string|nulldownloadFile()
public
downloadFile(File|string $fileOrPath[, mixed $destination = null ][, int $timeout = 30 ][, int $chunkSize = 65536 ]) : string|null
Parameters
- $fileOrPath : File|string
- $destination : mixed = null
- $timeout : int = 30
- $chunkSize : int = 65536
Return values
string|nullgetId()
Bot ID extracted from the token. Named `getId()` (not `id()`) because upstream `bot.id` is a Python @property — grep-translating aiogram code would see PHP return a method handle instead of the int. The explicit `getId()` makes the difference loud.
public
getId() : int
Return values
intme()
public
me() : User
Return values
UsersetCurrent()
public
static setCurrent(Bot|null $bot) : void
Parameters
- $bot : Bot|null