Skip to content

2.0.0

Choose a tag to compare

@Sempai-07 Sempai-07 released this 10 Sep 08:32
· 60 commits to v2 since this release

Telegramsjs@2.0.0

Added

  • Introduced the unpinAllGeneralForumTopicMessages method (API 6.8).
  • Added the inlineQuery method, which registers a callback function to execute when an inline query matches the specified text.
  • Added the gameQuery method, which registers a callback function when a message containing a "game" object is received.
  • Introduced the MenuBuilder class for creating menus with buttons.
  • Introduced the Keyboard class for creating menus from keyboards.
  • Added parameters to the TelegramBot(token, { limit, timeout, allowed_updates }) constructor.
  • Added a combine parameter to the TelegramBot.use method, which merges the previous session with the new one (default is false).
  • Added a caption parameter to the TelegramBot.hears method (whether to respond to captions, default is false).
  • Added new tests.

Removed

  • Removed the buildKeyboard and is2D methods from the Markup class, as all methods are now public by default (in plain JavaScript).
  • Removed the public keyword from all classes, as all methods are already public by default.
  • Removed the decodeIntents function.
  • Removed the IntentsBitField class.
  • Removed the leave and kickChatMember methods in the context.

Fixed

  • The context was missing methods that should have been present since version 1.7.4 (setMyDescription, getMyDescription, setMyShortDescription, setMyName, getMyName).
  • The setWebhook method was behaving like getMe.
  • In TelegramBot.command, if you specified, for example, test, test1, test2, and then wrote test, all commands (test1, test2) would execute along with test.
  • In TelegramBot.action, if you specified the answer parameter, it triggered for all interactions with callback_query:data.

Changed

  • intents is now TelegramBot.options.allowed_updates.
  • The type of session changed from any to unknown.
  • session now has default values ({}).
  • events no longer need to be described as before. Events of the type message:text and message:caption have also been added. (Will be added over time)
  • The Request class now accepts a generic type, which is done for events.
  • The on method now allows specifying an array of events. Type errors are added if a non-array and non-string is specified.
  • The Collection.hasKeys and Collection.hasValues methods now return false if emptiness is specified instead of an empty object.
  • The TelegramBot.command method, specifically the args parameter, will always return an array of strings, not undefined | string[].
  • The action, command, and hears methods return TelegramBot.
  • The send method in the context is no longer part of the chat object; it is now available as a method, for example, reply.
  • The following methods now accept two parameters: deleteWebhook, sendMessage, banChatSenderChat, unbanChatSenderChat, revokeChatInviteLink, approveChatJoinRequest, declineChatJoinRequest, setChatPhoto, deleteChatPhoto, setChatTitle, setChatDescription, unpinChatMessage, deleteMessage, answerWebAppQuery, setPassportDataErrors, setStickerSetTitle, setCustomEmojiStickerSetThumbnail, unpinAllChatMessages, getChatMember, setChatStickerSet, closeForumTopic, reopenForumTopic, deleteForumTopic, unpinAllForumTopicMessages, editGeneralForumTopic, deleteMyCommands, getMyCommands, setMyName, setMyDescription, setMyShortDescription, setChatMenuButton, setMyDefaultAdministratorRight, setStickerPositionInSet, setStickerEmojiList, setStickerKeywords, setStickerMaskPosition.

Miscellaneous

  • Improved code readability, added comments for all classes and methods.
  • Renamed variables to more logical names.
  • Renamed files and classes to more logical names.