Upcoming in v2: Support for PostegreSQL and TTL in Conversations
- Update to Bot API v5.2.
- Fixed crash when
pcntlis not available. - Webhook is now automatically set.
- Fixed
restart_on_changeswith spaces inside file path. - Improved regex handlers: regex will no longer be used on handlers with exact match conditions.
v1.9 - Source Code
-
New User mode: you can now run userbots with NovaGram using tdlight-telegram-bot-api. (Webhooks too!) Check out this example.
-
Bot API v5.1:
Check full changelog for more info
- New types:
ChatMemberUpdated,ChatInviteLink,VoiceChatStarted,VoiceChatEnded,VoiceChatParticipantsInvited,MessageAutoDeleteTimerChanged. - New methods:
createChatInviteLink,editChatInviteLink,revokeChatInviteLink. - New handlers:
onMyChatMember,onChatMember.
- New types:
-
New Features:
- New
onCallbackDatahandler: similar toonTextbut for Callback Queries data. - New
onNewChatMemberandonNewGrouphandlers: check updated docs. - New
exportCommandsmethod, that callssetMyCommandswith the registered command handlers (onCommand()). Automatically called by default on CLI restart_on_changeshas been improved: now it usespcntl_execwhen possible (instead ofshell_exec)- Added
User::getMention(): it generates a clickable link for that User. - Added new Class Handlers:
CommandHandlerandCallbackHandler - Added
toArray()andtoJSON()methods toObjectsListandTypeobjects - Added
ObjectsList::getLast(), useful if you work with photos, which are arrays ofPhotoSizes - Added autoload of class handlers: it will include and fire all handlers found by searching for files that ends with
Handler.php,Command.phpandCallback.php. Class names must be the same as file names. It won't look insidevendor. - Now
Message::editText()will not deletereply_markupby default. Usereply_markup: nullto force deleting it. - Added
Dispatcher::stopHandling()or simplystop_handling(), which stop other handlers from being executed (previously,exit()was needed) - Added
Database::getConversationsByName()
- New
-
New Bot settings:
username: Bot username, needed to avoid that other bot's commands are recognized in groups when using command handlers and webhook.export_commands: Whether to callBot::exportCommands()when idling on CLI. Default totrueinclude_classes: Whether to automatically include and fire Commands Class Handlers (includes all files that ends withCommand.php,Handler.php, andCallback.phpinside the main script directory). Defualt value istrueonCLIandfalseonWebhook.workers: Maximum amount of processes that will run simultaneously. (CLIonly)skip_old_updates: Whether to not process updates sent before starting the bot.
-
New Exceptions:
NotFoundException(404)MethodNotAllowedException(405)RequestEntityTooLargeException(413)
-
Fixes:
- Bot won't crash on uncaught internal exceptions.
- Conversations are now updated instead of deleted and reinserted.
- Classes
MessageId,ProximityAlertTriggereddidn't work properly - Bot will now process queued updates before retrieving other ones
- Fixed wrong behaviour when serializing false
- Default values for
log_updatesanddebugare nownullinstead offalse. - Now
log_updatessetting works on getUpdates too setMyCommandsarguments were wrong- Errors weren't handled when thrown inside class handlers
- Unknown objects are now instances of
stdClassorObjectsList - Exceptions constructor argument
$previous_exceptionwas anExceptioninstead of aThrowable - Entities parser didn't work with
ObjectsList - Some databases couldn't be used with
getUpdates, fixed onCommandhandler$argsargument behaviour was incorrect
-
Minor:
- Added
CurlException - Renamed
Bot::idle()toBot::start() - You can now use PHP8
named argumentsin Bot constructor instead of the$settingsarray JSONall all the related methods are now static in Bot, this makes faster using multiple bot instances- Now when using
getUpdatesprocess titles are customized in order to differenciate main process and child processes - Properties
User::dc_idandMessage::htmlare now cached - All the Objects are now serializable
- Added
$descriptionparameter toonCommand - Improvements in
Prototypes:isPrototypeableis now cached
- Added
v1.8 - Source Code
- New handlers:
onTextMessage,onText, andonCommand - New Bot settings:
command_prefixes: Array of characters for commands prefixes. e.g./start,.infogroup_handlers: Whether to execute all the handlers of an update in the same process (true), or fork a process for each handler (false)wait_handlers: Whether to wait for handlers to finish when closing scriptthreshold: Amount of max seconds the script will sleep instead of throwing aTooManyRequestsException. Defaults to 10 when usinggetUpdatesonly_if_banned: Default value foronly_if_bannedparameter inunbanChatMembermethod
- Conversations full getters
getConversationsByChat(User|Chat::getConversations())getConversationsByValue
amphphas been removed, now skrtdev/async is used in classes too- Added all class handlers:
onMessage,onEditedMessage,onChannelPost, etcallowed_updatesis automatically generated from classes too$this->Botcan be used to getBotinstance inside Class handlers- More classes can be handled in a single
handleClasscall
- Now when using
getUpdatesbot won't crash onBadGatewayExceptions, it will retry to connect every second instead - Now
var_dumpis used instead ofprint_rindebugfunctions - Now list of Objects are instances of
ObjectsListrather than instances ofstdClass - You can now use PHP8
named argumentsinstead of the$argsarray in bothBotandObjectsmethods - A custom
PDOinstance can now be used as database. Pass it in the database Bot setting instead of the Database array (novagramwill be used as prefix) Exception::$response_parametersis now an instance ofResponseParametersor null- Return types of every method has been updated
- Now a warning is emitted when using getUpdates if a webhook url is set
v1.7 - Source Code
- Improved performances of skrtdev/async
- Bot API 5.0
- Own Bot API Server: added new
bot_api_urlparameter to bot settings - Added
allow_sending_without_replyglobal parameter to bot settings - Updated all objects and methods
- Added the new ChatLocation Object
- Added all new Methods
- Own Bot API Server: added new
- New Exception:
UnauthorizedException(401) allowed_updatesis automatically generated when using getUpdates, so bot is faster if it receives many unwanted updates- Improved Composer Autoloader (PSR-4)
v1.6.1 - Bug Fix Release
- Fixed a bug that affected webhook
v1.6 - Source Code
-
Improved Composer Autoloader (PSR-4)
-
Added getUpdates mode (multi-processing)
- New
Dispatcherclass - Mode (Webhook/getUpdates/None) is recognized automatically
- Optional async handling of updates
- Closure Handlers (skrtdev/async)
- Full handlers (onUpdate, onMessage, onCallbackQuery, etc.)
- Error handler
- Class Handlers (amphp/amp)
- Only Update handler
- Auto restart when Bot file is edited (optional)
- New
-
Many new Exceptions
BadRequestException(400)ForbiddenException(403)ConflictException(409)TooManyRequestsException(429)BadGatewayException(502) (yes, sometimes it happens)
-
Changes in Bot settings
- Changed behaviour of settings'
debugparameter: now it creates an Error Handler async: Concurrent handling of updatesrestart_on_changes: Auto restart when Bot file is edited (optional)logger:Monolog\Loggerconstant for logging
- Changed behaviour of settings'
-
Now you can pass your custom
Monolog\Logger, as the 3rd parameter of the Bot constructor -
Some improvements to Prototypes
$thisinside prototype now refers to the Object, so that$selfis no longer needed -
Fixed many bugs in HTML Entities Parser
v1.5.1 - Bug Fix Release
-
Fixed a bug with Prototypes and Objects
Prototypes Methods couldn't be added directly to objects
v1.5 - Source Code
-
Added positional arguments and named arguments (like
python kwargs) to Types Methods (in a BC way)Check updated docs
-
Bot and Database Classes are now prototypeable
Learn more about prototypes here
-
Full Return Types implementation
-
Added some HTML tags to Entities Parser
Message::toHTML() is now removed in favor of Message::getHTMLText()
-
Built-in debug now looks like a normal exception
-
NULLproperties are no longer displayed in debug functions (such asvar_dump,print_rand similar) -
Updated docs
v1.4 - Source Code
-
Added Typed Properties with Description to every Object
-
Added non-dinamic Methods to Bot Class
-
Added positional arguments and named arguments (like
python kwargs) to Bot Methods (in a BC way)Check updated docs
-
Added Entities Parser, and Message::toHTML() Method