phpbotgram

BotShortcutsContract

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
Closure

current()

Fiber-local "current bot" accessor; ported from aiogram/utils/mixins.py ContextInstanceMixin.

public static current() : Bot|null
Return values
Bot|null

download()

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|null

downloadFile()

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|null

getId()

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
int
On this page

Search results