Skip to content

Upgrading from v1 to v2

Camilo Sperberg edited this page Nov 17, 2016 · 1 revision

If you used v1.x of this package before, be aware of the v2 changes! There are changes in this package (so named "internal changes") as well as in the Telegram API as well (called "External changes").

Internal changes:

The most important change is that the package has a different namespace now! It used to be:

unreal4u\

Now it is:

unreal4u\TelegramAPI\

The other big change is that InlineQueryResult* classes now have their own namespace. So, what used to be:

$inlineQueryResultArticle = new unreal4u\Telegram\Types\InlineQueryResultArticle();

Is now:

$inlineQueryResultArticle = new unreal4u\TelegramAPI\Telegram\Types\Inline\Query\Result\Article();

Please note the extra backslash between Inline, query, result and Article.

The same is true for the other 18 new Inline\Query\Results.

Other changes include ChosenInlineResult (now Inline\ChosenResult) and InlineQuery (now Inline\Query).

External changes:

Telegram objects are a bit different. Some backwards incompatible changes are:

  • The ReplyKeyboardMarkup object no longer is an array of strings, but an array of KeyboardButton
  • The AnswerInlineQuery object now includes a new reply_markup and a input_message_content field, which is an optional inline keyboard attached to the message
  • The InlineQueryResult objects had a major revamp, so many options were replaced with others. Please consult the documentation regarding these objects