Compare commits

...

618 commits

Author SHA1 Message Date
netkas
5bff732814 Updated CHANGELOG.md 2024-12-20 03:10:19 -05:00
netkas
c52d2f3601 Add support for handling callback query events 2024-12-20 03:09:49 -05:00
netkas
f9741c250d Added containsMedia method to Message object to check if the message contains media. 2024-12-09 12:19:42 -05:00
netkas
07ff3c4d2b Bumped version to 8.0.2 2024-12-07 00:52:35 -05:00
netkas
c4fdd71bdc Updated CHANGELOG.md 2024-12-04 13:38:11 -05:00
netkas
3c692424f7 Allow nullable type for MessageEntity type 2024-12-04 13:36:50 -05:00
netkas
8408430ef8 Refactor PollingBot to use PsyncLib for updates 2024-12-04 13:36:49 -05:00
netkas
a66f27b5e6 Encode arrays as JSON in SendAudio parameters 2024-12-02 14:52:34 -05:00
netkas
14c1aaaa44 Refactor fromArray method for null data handling 2024-12-02 13:51:01 -05:00
netkas
17318e5724 Refactor optional parameters in method signatures 2024-12-02 13:34:47 -05:00
netkas
69916fed3e Improve command check with method existence validation 2024-11-29 22:06:07 -05:00
netkas
47f47f2110 Updated CHANGELOG.md 2024-11-29 19:18:57 -05:00
netkas
cb016a7fff Reposition debug log for event handler execution. 2024-11-29 19:18:49 -05:00
netkas
ca4bce7052 Bumped version to 8.0.1 2024-11-29 19:18:23 -05:00
netkas
f3af237d02 Merge remote-tracking branch 'github/master'
# Conflicts:
#	CHANGELOG.md
#	project.json
#	src/TgBotLib/Bot.php
2024-11-29 00:41:19 -05:00
netkas
1e151f9ce6 Update CHANGELOG with release date and deprecation note 2024-11-29 00:38:45 -05:00
netkas
d7d6ebda23 Add deleteWebhook and getWebhookInfo methods to Bot class 2024-11-29 00:37:13 -05:00
netkas
3959680e15 Add game and passport error handling methods 2024-11-29 00:30:09 -05:00
netkas
8fb2d3a943 Add new methods for handling payments and web apps 2024-11-29 00:26:26 -05:00
netkas
b8e5b59241 Add InlineQueryResultsButton class and integration 2024-11-28 21:57:58 -05:00
netkas
8aac6544a6 Add SendGift method to send gifts to users 2024-11-28 15:38:35 -05:00
netkas
939c736e1e Add support for retrieving available gifts 2024-11-28 15:33:04 -05:00
netkas
2cdd327abf Add sticker methods to Bot class 2024-11-28 15:25:02 -05:00
netkas
25e62db274 Add new message control and editing methods to Bot 2024-11-28 15:12:27 -05:00
netkas
02ce45a643 Enhance execute method to handle boolean result 2024-11-28 14:58:18 -05:00
netkas
4dfa3f3c59 Add method editMessageMedia to Bot class 2024-11-28 00:45:34 -05:00
netkas
2db766529e Add method to edit message captions 2024-11-28 00:41:20 -05:00
netkas
fb99adae74 Add editMessageText method to Bot class 2024-11-28 00:38:43 -05:00
netkas
ca194cfb52 Add methods to set and get default admin rights 2024-11-28 00:35:20 -05:00
netkas
73a09760b1 Add getChatMenuButton method to Bot class 2024-11-28 00:33:43 -05:00
netkas
4886173e89 Implement UnbanChatMember method in TgBotLib. 2024-11-28 00:30:41 -05:00
netkas
d19c74e35a Add GetGameHighScores method 2024-11-28 00:29:30 -05:00
netkas
ecac3c6ae5 Add SetGameScore method 2024-11-28 00:24:43 -05:00
netkas
6119b39ec7 Add SendGame method 2024-11-28 00:22:42 -05:00
netkas
d206d20dd5 Add SetPassportDataErrors method 2024-11-27 21:55:15 -05:00
netkas
7ea986a555 Add PassportElementError handling classes 2024-11-27 19:28:56 -05:00
netkas
e22792cc8e Updated CHANGELOG.md 2024-11-27 15:40:19 -05:00
netkas
d8dc131df6 Updated CHANGELOG.md 2024-11-27 15:39:40 -05:00
netkas
990a7bbfca Bumped version to 8.0.0 2024-11-27 15:39:25 -05:00
netkas
53acc6c664 Added method GetSTarTransactions 2024-11-27 15:04:15 -05:00
netkas
672ab564c2 Add AnswerPreCheckoutQuery method 2024-11-27 14:45:18 -05:00
netkas
932178d203 Add AnswerShippingQuery method 2024-11-22 22:11:29 -05:00
netkas
791362e9c1 Oops 2024-11-22 15:29:40 -05:00
netkas
7c895ec9bc Add CreateInvoiceLink method 2024-11-22 15:27:14 -05:00
netkas
79b5869ae4 Forgot something 2024-11-22 15:18:37 -05:00
netkas
4735af473f Add SendInvoice method and object 2024-11-22 15:18:02 -05:00
netkas
cef24db929 Add PreparedInlineMessage and SavePreparedInlineMessage 2024-11-22 15:07:44 -05:00
netkas
4ace03c02d Add AnswerWebAppQuery method 2024-11-15 15:41:59 -05:00
netkas
c4b08b5ab9 Add AnswerInlineQuery method 2024-11-15 15:22:31 -05:00
netkas
ee5f8fb06f Add DeleteStickerSet method 2024-11-15 15:18:05 -05:00
netkas
9468bdda90 Add SetCustomEmojiStickerSetThumbnail method 2024-11-15 15:14:10 -05:00
netkas
c5e0e1992a Add SetStickerSetThumbnail method 2024-11-15 15:11:25 -05:00
netkas
f5a09f90e9 Add SetStickerSetTitle method 2024-11-15 15:08:01 -05:00
netkas
c7196005ac Add SetStickerMaskPosition method 2024-11-15 15:05:48 -05:00
netkas
3bfdb2491c Added SetStickerEmojiList method 2024-11-15 15:00:48 -05:00
netkas
c18a5778bc Add ReplaceStickerInSet method 2024-11-15 14:57:09 -05:00
netkas
cd03e91807 Add DeleteStickerFromSet method 2024-11-15 00:34:19 -05:00
netkas
9a7fb4194f Add SetStickerPositionInSet method 2024-11-15 00:32:38 -05:00
netkas
a4e36af33c Add AddStickerToSet method 2024-11-15 00:30:08 -05:00
netkas
94de6b6d54 Add CreateNewStickerSet method 2024-11-15 00:27:02 -05:00
netkas
36bc36e208 Add UploadStickerFile method 2024-11-14 22:42:29 -05:00
netkas
58a04ba94c Rename files and update namespaces to reflect methods 2024-11-14 22:40:27 -05:00
netkas
36e2305ce7 Add GetCustomEmojiStickers method 2024-11-14 22:37:56 -05:00
netkas
a5b472794d Add GetStickerSet method 2024-11-14 22:36:02 -05:00
netkas
ea6fe91d9d Add method sendStickers 2024-11-14 00:38:23 -05:00
netkas
c01b8653c5 Add DeleteMessages method 2024-11-14 00:34:11 -05:00
netkas
ae7facc255 Add DeleteMessage method 2024-11-14 00:31:47 -05:00
netkas
06b57feb9c Add StopPoll method 2024-11-14 00:29:55 -05:00
netkas
491137d5a4 Refactor execute method to return Message object 2024-11-14 00:28:12 -05:00
netkas
91770ecbf6 Add EditMessageReplyMarkup method 2024-11-14 00:27:18 -05:00
netkas
fe14ea249a Add StopMessageLiveLocation method 2024-11-14 00:25:44 -05:00
netkas
fccb461e34 Add EditMessageLiveLocation method 2024-11-14 00:22:17 -05:00
netkas
fe42f8747f Update return type of execute method in EditMessageMedia 2024-11-14 00:21:17 -05:00
netkas
6e6e207c54 Add EditMessageMedia method 2024-11-14 00:19:26 -05:00
netkas
0486a7f0ab Add EditMessageCaption 2024-11-13 22:07:56 -05:00
netkas
d0519193eb Add EditMessageText 2024-11-13 21:59:16 -05:00
netkas
e0543413e3 Add GetMyDefaultAdministratorRights 2024-11-13 21:50:11 -05:00
netkas
c61c37be02 Add SetMyDefaultAdministratorRights 2024-11-13 21:47:02 -05:00
netkas
95020c9ed9 Add GetChatMenuButton method 2024-11-13 19:27:40 -05:00
netkas
61c73a13d1 Add SetChatMenuButton method 2024-11-13 15:48:58 -05:00
netkas
50d6ddd152 Add GetMyShortDescription 2024-11-13 15:46:17 -05:00
netkas
e1f6b63bb7 Add SetMyShortDescription method 2024-11-13 15:44:36 -05:00
netkas
d45bf4f261 Add GetMyDescription method to fetch bot description 2024-11-13 15:29:53 -05:00
netkas
3d996ba892 Add support for setting bot description 2024-11-13 15:27:41 -05:00
netkas
bf648ec2af Add GetMyName method to TgBotLib 2024-11-13 15:25:17 -05:00
netkas
d6f13f3177 Add SetMyName method for configuring bot name 2024-11-13 15:23:40 -05:00
netkas
c1d515de0c Add GetMyCommands method to TgBotLib 2024-11-13 15:18:58 -05:00
netkas
c48dbda47b Encode scope parameter to JSON in SetMyCommands method 2024-11-13 15:16:27 -05:00
netkas
c7eec21824 Add DeleteMyCommands method 2024-11-13 15:16:17 -05:00
netkas
b9a46da443 Add SetMyCommands method 2024-11-13 15:11:57 -05:00
netkas
527d546a78 Fix typo in method name 2024-11-07 01:05:31 -05:00
netkas
af7473aa05 Add GetBusinessConnection method 2024-11-07 01:02:43 -05:00
netkas
69f796b951 Add GetUserChatBoosts method 2024-11-07 01:01:06 -05:00
netkas
be210c5411 Add AnswerCallbackQuery method to handle callback queries 2024-11-07 00:58:58 -05:00
netkas
17369210d5 Add unpinAllGeneralForumTopicMessages method 2024-11-07 00:57:23 -05:00
netkas
ec7c4b5882 Add UnhideGeneralForumTopic method 2024-11-07 00:55:25 -05:00
netkas
18bd8ce69e Add 'HideGeneralForumTopic' method 2024-11-07 00:54:14 -05:00
netkas
89af7589cb Add ReopenGeneralForumTopic method 2024-11-07 00:52:20 -05:00
netkas
9ea36578df Add CloseGeneralForumTopic method 2024-11-07 00:51:09 -05:00
netkas
175754649c Add EditGeneralForumTopic method 2024-11-07 00:49:26 -05:00
netkas
524475a757 Add UnpinAllForumTopicMessages method 2024-11-07 00:48:08 -05:00
netkas
44dfe821c1 Add DeleteForumTopic method 2024-11-07 00:46:23 -05:00
netkas
cad5face2d Add ReopenForumTopic method 2024-11-07 00:44:43 -05:00
netkas
9e3d5dcaaf Add CloseForumTopic method 2024-11-07 00:43:15 -05:00
netkas
588d1b099d Add EditForumTopic Method 2024-11-06 19:28:26 -05:00
netkas
530cc3e402 Add CreateForumTopic method to TgBotLib 2024-11-06 19:26:43 -05:00
netkas
4accf1713c Add support for fetching forum topic icon stickers 2024-11-06 19:24:59 -05:00
netkas
fedf177803 Add DeleteChatStickerSet method to TgBotLib 2024-11-06 19:22:39 -05:00
netkas
f000bc422d Add SetChatStickerSet method 2024-11-06 19:21:23 -05:00
netkas
4893a23bfa Add GetChatMember method functionality 2024-11-06 17:24:15 -05:00
netkas
576deca185 Add GetChatMemberCount method to TgBotLib 2024-11-06 17:22:24 -05:00
netkas
7a18d72419 Add GetChatAdministrators method 2024-11-06 17:19:06 -05:00
netkas
4be031f96c Add GetChat method to retrieve chat details 2024-11-06 17:17:13 -05:00
netkas
1661e744ab Add LeaveChat method to bot API 2024-11-06 17:14:20 -05:00
netkas
7ee714b36c Add unpinAllChatMessages method 2024-11-06 17:13:08 -05:00
netkas
94d8922a49 Add method to unpin chat messages 2024-11-06 17:11:45 -05:00
netkas
2aca204f16 Add PinChatMessage method 2024-11-06 17:10:01 -05:00
netkas
5bf3dde316 Add SetChatDescription method 2024-11-06 17:08:25 -05:00
netkas
3acdb17d46 Add SetChatTitle method 2024-11-06 15:46:39 -05:00
netkas
4d40f8f3a3 Add DeleteChatPhoto method 2024-11-06 15:44:14 -05:00
netkas
17f1599797 Add SetChatPhoto method to handle chat photo updates 2024-11-06 15:42:43 -05:00
netkas
9889abf149 Add DeclineChatJoinRequest Method 2024-11-06 15:39:58 -05:00
netkas
78b4f8c24d Add ApproveChatJoinRequest method 2024-11-06 15:20:41 -05:00
netkas
5b05fe155b Add RevokeChatInviteLink method 2024-11-06 15:18:38 -05:00
netkas
b116ec4447 Add EditChatSubscriptionInviteLink method 2024-11-06 15:15:15 -05:00
netkas
59af689364 Correction 2024-11-06 15:10:25 -05:00
netkas
9817608eb7 Add CreateChatSubscriptionInviteLink method 2024-11-06 15:06:07 -05:00
netkas
646c77c4ba Move UpdateEvent to Events and remove unused import 2024-11-06 15:02:43 -05:00
netkas
24fe2f2b91 Add EditChatInviteLink method to the library 2024-11-06 15:01:52 -05:00
netkas
6315f5840d Add CreateChatInviteLink method to the library 2024-11-06 14:59:07 -05:00
netkas
2f2fefbe9d Add ExportChatInviteLink method to TgBotLib 2024-11-06 00:24:46 -05:00
netkas
307521debc Add SetChatPermissions method to TgBotLib 2024-11-06 00:23:10 -05:00
netkas
db3500d46e Add unban chat sender functionality 2024-11-06 00:20:22 -05:00
netkas
3757b9106a Add BanChatSenderChat method to TgBotLib 2024-11-06 00:18:45 -05:00
netkas
c535977bac Add SetChatAdministratorCustomTitle method 2024-11-06 00:16:34 -05:00
netkas
47fde54d40 Add PromoteChatMember method to TgBotLib 2024-11-05 21:27:13 -05:00
netkas
8119e791e4 Add RestrictChatMember method to bot library 2024-11-05 21:22:33 -05:00
netkas
2377b239f3 Add UnbanChatMember method to TgBotLib 2024-11-05 19:26:16 -05:00
netkas
9e2e19d593 Add BanChatMember method to TgBotLib 2024-11-05 19:24:25 -05:00
netkas
d9dd03f601 Refactor user profile photos request handling. 2024-11-05 19:22:13 -05:00
netkas
3cac471f1e Add GetFile method to fetch file details from Telegram API 2024-11-05 19:21:54 -05:00
netkas
44260ccaee Add 'GetUserProfilePhotos' method support 2024-11-05 19:19:14 -05:00
netkas
ee2dff1e31 Add new source folder and fix method enums 2024-11-05 15:44:03 -05:00
netkas
2900b708da Handle exceptions in command and event handlers 2024-11-05 15:42:34 -05:00
netkas
12a091ce80 Refactor command inclusion logic in getText and getCaption 2024-11-05 13:11:04 -05:00
netkas
b826d0d4dd Add includeCommand parameter to getAnyText method 2024-11-05 13:07:25 -05:00
netkas
6c6d7abb56 Add command stripping option to getText and getCaption 2024-11-05 11:54:23 -05:00
netkas
946e110131 Add child process management for polling updates 2024-11-04 22:04:58 -05:00
netkas
87f9321280 Add abstract handle method in UpdateEvent 2024-11-04 15:19:29 -05:00
netkas
f03490cb6c Improve command handling in PollingBot 2024-11-04 13:49:50 -05:00
netkas
439ccdb123 Improve command handling in PollingBot 2024-11-04 01:22:30 -05:00
netkas
a4af8fd1b7 Refactor command handler invocation in PollingBot 2024-11-04 01:20:06 -05:00
netkas
42c3138d3b Refactor command handling in PollingBot 2024-11-04 01:19:44 -05:00
netkas
e2bc3010af Fix nullable update handling in PollingBot 2024-11-04 01:17:47 -05:00
netkas
ba6e991b23 Add method to retrieve any available message 2024-11-04 01:17:15 -05:00
netkas
513344b4a6 Add command handling in PollingBot 2024-11-04 01:17:03 -05:00
netkas
7cfd6c0c5f Add methods to retrieve text and commands from messages 2024-11-04 01:16:55 -05:00
netkas
6b9ecaa153 Add CommandEvent to EventType enum 2024-11-04 01:16:47 -05:00
netkas
53824b7126 Add method to retrieve event handlers by command 2024-11-04 01:16:35 -05:00
netkas
1cf82401c3 Add CommandEvent class to handle bot commands 2024-11-04 01:16:21 -05:00
netkas
89d52f81aa Add net.nosial.optslib dependency 2024-11-04 01:06:23 -05:00
netkas
3e860ea089 Refactor README: Remove detailed sections 2024-11-04 00:58:24 -05:00
netkas
e88e18995e Add forking capability for update processing 2024-11-04 00:56:21 -05:00
netkas
1eaf2e7d91 Remove unused imports across multiple files 2024-11-03 18:26:12 -05:00
netkas
7623f488ee Rename UpdateEventType to EventType for consistency 2024-11-03 18:25:42 -05:00
netkas
a24c617c9f Remove EventType enumeration 2024-11-03 18:25:15 -05:00
netkas
a89e968a40 Oops 2024-11-03 18:23:34 -05:00
netkas
32d8e233b8 - Remove nullsafe operator from location property
- Fix user serialization in TransactionPartnerUser
 - Remove null check for stickers in StickerSet
 - Fix nullable operator usage in ShippingQuery toArray method
 - Remove null-safe operator for traveler and watcher
 - Fix null-safe operator in PreCheckoutQuery.php
 - Fix null safe operator usage in PollAnswer.php
 - Refactor null checks in PassportData methods
 - Remove nullsafe operator from chat property
 - Refactor web_app handling in MenuButtonWebApp class
 - Fix conditional assignment in InputMediaVideo
 - Fix null coalescing and array mapping in InputMediaAudio
 - Fix redundant null coalescing in caption_entities mapping
 - Fix parsing of caption_entities field in InlineQueryResultPhoto
 - Fix potential unnecessary null coalescing in caption_entities
 - Fix redundant null coalescence check in reply_markup assignment
 - Fix redundant null coalescing in array_map calls
 - Refactor: remove unnecessary null coalescing operator
 - Fix conditional check for caption_entities assignment
 - Fix handling of input_message_content array conversion
 - Fix potential null pointer issue in InlineQuery class
 - Remove redundant null check in toArray method
 - Fix redundant null coalesce operator in photo mapping
 - Remove null safe operator for origin
 - Fix redundant null coalescing in array_map calls.
 - Fix optional chaining error in ChosenInlineResult.php
 - Remove null-safe operator in toArray() method
 - Fix null safe operator usage in ChatMemberRestricted
 - Fix null-safe operator usage in ChatMemberOwner.php
 - Fix null safe operator usage in ChatMemberMember.php
 - Fix nullable operator usage in ChatMemberLeft class
 - Fix null-safe operator in ChatMemberBanned serialization.
 - Fix user attribute null coalescing in ChatMemberAdministrator
 - Fix null-safe operator usage in ChatLocation conversion
 - Remove null safe operator in toArray() method
 - Fix nullable operator usage in ChatInviteLink serialization
 - Fix potential null pointer issue in ChatBoostSourcePremium.
 - Remove null safe operator in ChatBoostRemoved toArray method
 - Fix 'from' property serialization in CallbackQuery
 - Fix nullable operator usage on chat property
 - Remove redundant type check for associative array
 - Remove deprecated BotOld.php file
2024-11-03 18:19:27 -05:00
netkas
7b16b2bbc6 Add SetMessageReaction method 2024-11-03 18:05:05 -05:00
netkas
547c19888a Add GetWebhookInfo method to fetch webhook info 2024-11-03 17:55:47 -05:00
netkas
e6f80ae85c Refactor return type of DeleteWebhook::execute method 2024-11-03 17:54:29 -05:00
netkas
76b6590f79 Add DeleteWebhook method to handle webhook deletions 2024-11-03 17:46:16 -05:00
netkas
e7f89d7e0d Fix incorrect event type mapping for shipping query 2024-11-03 17:31:59 -05:00
netkas
f26f1c963f Update documentation com 2024-11-03 17:28:51 -05:00
netkas
56c7fb04d2 Refactor event type determination logic 2024-11-03 17:22:45 -05:00
netkas
4829853d0e Add Edited Message Event support 2024-11-03 17:20:16 -05:00
netkas
2a08cc51de Add support for handling channel post events 2024-11-03 17:18:39 -05:00
netkas
041c2dc84c Add support for edited channel post events 2024-11-03 17:15:47 -05:00
netkas
325e29a930 Add BusinessConnection event support 2024-11-03 17:14:07 -05:00
netkas
2b8f9afa49 Remove unused import from UpdateEventType enum 2024-11-03 17:12:00 -05:00
netkas
2f87996bd3 Add support for business message events 2024-11-03 17:11:16 -05:00
netkas
b40ee01d6e Add support for edited business messages 2024-11-02 00:27:17 -04:00
netkas
775a5ab71f Add support for deleted business messages event 2024-11-02 00:24:18 -04:00
netkas
b4a7d69c3c Removed UpdateEventType.php deprecated 2024-11-02 00:22:32 -04:00
netkas
bcf23f3834 Add support for message reaction event handling 2024-11-02 00:22:25 -04:00
netkas
ada256566e Add support for message reaction count events 2024-11-02 00:20:28 -04:00
netkas
ac431136de Add support for handling inline query events 2024-11-02 00:18:14 -04:00
netkas
a212671c49 Add support for ChosenInlineResult events 2024-11-02 00:16:48 -04:00
netkas
709e5794d5 Add support for CallbackQuery events. 2024-11-01 21:54:05 -04:00
netkas
e843c8ca4f Add support for ShippingQuery events 2024-11-01 21:50:21 -04:00
netkas
f1342e3f42 Add PreCheckoutQueryEvent handling 2024-11-01 21:33:47 -04:00
netkas
c57cdfe05c Add support for Paid Media Purchased event 2024-11-01 21:30:41 -04:00
netkas
39821585e4 Add detailed docblocks to PollingBot class methods 2024-11-01 21:25:50 -04:00
netkas
95e9118bfb Enhance event handler selection in PollingBot 2024-11-01 18:21:40 -04:00
netkas
31550fc1dc Add PollEvent to handle new poll updates 2024-11-01 18:19:47 -04:00
netkas
d56cc3dd22 Add support for handling poll answer updates 2024-11-01 18:16:17 -04:00
netkas
3ce87cabcb Add support for MyChatMemberUpdatedEvent 2024-11-01 18:13:09 -04:00
netkas
73d14179b1 Rename EventType to UpdateEventType for clarity 2024-11-01 18:11:11 -04:00
netkas
b8b1a87639 Add ChatMemberUpdatedEvent handling 2024-11-01 18:09:14 -04:00
netkas
c7edc420f3 Add doc comments for event methods 2024-11-01 18:05:02 -04:00
netkas
cd691703ee Add WebhookBot class for handling Telegram webhook requests 2024-11-01 18:04:20 -04:00
netkas
ff245ad315 Add event type determination method to Utilities 2024-11-01 18:04:11 -04:00
netkas
95346f78cd Add UpdateEvent abstract class 2024-11-01 18:04:02 -04:00
netkas
b58aa3a5fc Rename ChatBoostAdded to ChatBoostUpdated 2024-11-01 18:03:50 -04:00
netkas
f83b5ac40f Add RemovedChatBoostEvent class 2024-11-01 15:47:09 -04:00
netkas
da553c3bc9 Add PollingBot class to handle Telegram polling updates 2024-11-01 15:47:02 -04:00
netkas
374e3907c4 Add EventType enum for standardized event handling 2024-11-01 15:46:55 -04:00
netkas
734adf2f7d Add ChatJoinRequestEvent class 2024-11-01 15:46:47 -04:00
netkas
27d1dce80f Add ChatBoostUpdated object 2024-11-01 15:46:39 -04:00
netkas
6787654243 Add ChatBoostEvent class 2024-11-01 15:46:32 -04:00
netkas
40fd31cc79 Add event handling system to Bot class 2024-11-01 15:46:24 -04:00
netkas
1db75f74f6 Updated tgbot.iml 2024-11-01 14:01:32 -04:00
netkas
d702ddb120 Update logger dependencies and add Logger class 2024-11-01 14:01:25 -04:00
netkas
f8e5b0f632 Add SetWebhook method and integrate with Methods enum 2024-11-01 13:51:52 -04:00
netkas
f2f26998ad Fix object instantiation and add getUpdate functionality 2024-11-01 13:24:11 -04:00
netkas
845a0d3b3c Add GetUpdates method for fetching updates 2024-11-01 12:44:54 -04:00
netkas
ead1347f34 Implemented method sendChatAction 2024-10-31 00:22:07 -04:00
netkas
97346e217c Updated Idea projects 2024-10-31 00:07:26 -04:00
netkas
b8f6c81833 Added method SendDice 2024-10-31 00:07:09 -04:00
netkas
64e40f62cb Minor correction 2024-10-14 15:42:53 -04:00
netkas
d875d7282d Minor correction 2024-10-14 15:40:01 -04:00
netkas
868d2d3748 Updated Build System 2024-10-14 15:33:49 -04:00
netkas
1dd3be5802 Updated ncc_workflow.yml 2024-10-14 14:38:50 -04:00
netkas
1a130d948c Updated Build System & .gitignore 2024-10-14 14:37:35 -04:00
netkas
705bbe6b3c Test Commit 2024-10-11 15:26:53 -04:00
netkas
e991cf8183 Test Commit 2024-10-11 15:21:43 -04:00
netkas
2b67b085ad Test Commit 2024-10-11 15:17:12 -04:00
netkas
bc27a597eb Updated workflow 2024-10-10 15:11:07 -04:00
netkas
b7d2d4072a Updated build 2024-10-10 15:10:05 -04:00
netkas
88f1ebddeb Updated build 2024-10-10 15:09:09 -04:00
netkas
a116697e24 Updated ncc_workflow.yml 2024-10-10 14:31:25 -04:00
netkas
20aeccc2ba Updated ncc_workflow.yml 2024-10-10 14:27:24 -04:00
netkas
db18d8b826 Updated workflow 2024-10-10 14:26:01 -04:00
netkas
a3049d3355 Updated Build system 2024-10-10 14:24:43 -04:00
netkas
9a4e537294 Add SendPoll method with tests and enhance Poll object 2024-10-10 13:20:40 -04:00
netkas
33f7a094fc Minor refactoring 2024-10-10 12:48:17 -04:00
netkas
561542bc62 Add SendContact method with corresponding test. 2024-10-10 12:47:37 -04:00
netkas
012fc4fe0f Add SendVenue method to send venue information 2024-10-10 12:26:12 -04:00
netkas
e4787b90a1 Add sendLocation method with validation and unit tests 2024-10-10 12:21:34 -04:00
netkas
891bd6f183 Add SendMediaGroup method to send media albums 2024-10-10 12:15:42 -04:00
netkas
0145279516 Refactor media handling in InputMedia classes 2024-10-10 12:15:33 -04:00
netkas
427102a635 Add constructors and setters to InputMedia classes 2024-10-09 20:57:04 -04:00
netkas
19b4d2ef45 Added SendPaidMedia method 2024-10-09 17:55:19 -04:00
netkas
0298049ca2 Add keyboard markup tests and constructors to objects 2024-10-09 17:50:57 -04:00
netkas
560721ffc8 Add validation braces and constructor docstring 2024-10-09 17:38:13 -04:00
netkas
744771445e Enhance reply_markup handling and add SendPaidMedia method. 2024-10-09 15:25:19 -04:00
netkas
b58943c7c2 Corrected SendVoiceTest 2024-10-09 15:17:22 -04:00
netkas
0fec9211af Corrected SendVoiceTest 2024-10-09 15:13:53 -04:00
netkas
de3a887af7 Minor correction 2024-10-09 15:11:55 -04:00
netkas
27ffc3408d Added SendVideoNote method 2024-10-09 15:10:32 -04:00
netkas
5d1b07c4c4 Enable auto-retry feature and expand Bot functionality 2024-10-09 15:04:34 -04:00
netkas
e7c438bc6a Added SendVoice method 2024-10-09 14:21:50 -04:00
netkas
d528993069 Add constructors and improve toArray implementations
Introduce constructors in InlineKeyboardButton and optimize the toArray methods for both InlineKeyboardButton and InlineKeyboardMarkup classes. This improves object initialization and makes the array conversion process more robust and readable.
2024-10-09 14:07:41 -04:00
netkas
738e6bd0f4 Updated SendAnimation 2024-10-09 13:32:23 -04:00
netkas
4935373cda Added SendAnimation method 2024-10-09 13:29:09 -04:00
netkas
02d9fe69d9 Added BotName 2024-10-09 13:13:28 -04:00
netkas
4558ebb9a7 Added ChatBoost 2024-10-09 13:13:21 -04:00
netkas
22f28c5711 Added UserChatBoosts 2024-10-09 13:13:15 -04:00
netkas
f17915bab6 Added SendVideo Method 2024-10-08 15:35:54 -04:00
netkas
54a7f410af Added InputPollOption 2024-10-08 15:35:31 -04:00
netkas
cd2967ee06 Added dependency install stage 2024-10-08 14:24:18 -04:00
netkas
c044bf0909 Minor correction 2024-10-08 14:22:22 -04:00
netkas
e797266008 Minor correction 2024-10-08 14:19:25 -04:00
netkas
e1f0b459d8 Added PhpDoc generating to CI (test) 2024-10-08 14:18:11 -04:00
netkas
dc9ca57e52 Add support for sending documents 2024-10-08 13:58:22 -04:00
netkas
3623b63eaa Add sendAudio method to Bot 2024-10-08 13:41:56 -04:00
netkas
a9a6d5a2b3 Add SendPhoto method for sending photos in TgBotLib 2024-10-08 13:09:53 -04:00
netkas
294b25ad26 Add copyMessages method for bulk message copying 2024-10-08 12:32:47 -04:00
netkas
ebea95b930 Updated Formatting 2024-10-08 12:32:36 -04:00
netkas
ae5a9130b6 Add CopyMessage method to TgBotLib 2024-10-08 00:26:09 -04:00
netkas
75ed7676ac Define TEST_CHAT_ID as a global constant. 2024-10-08 00:23:25 -04:00
netkas
d02cab3846 Add bootstrap file path to PHP Unit settings 2024-10-08 00:13:32 -04:00
netkas
2e58fcf108 Add forwardMessages method for batch forwarding 2024-10-08 00:13:23 -04:00
netkas
5e52ceea4b Updated PhpDocs 2024-10-07 22:04:26 -04:00
netkas
17ff223461 Add forwardMessage method 2024-10-07 19:39:18 -04:00
netkas
4d45add53e Updated SendMessage 2024-10-07 19:33:26 -04:00
netkas
1ed547eb86 Added PhpDoc to ignore 2024-10-07 15:46:39 -04:00
netkas
1835ccc08e Updated ReplyKeyboardRemove 2024-10-07 15:43:09 -04:00
netkas
b132c2c982 Updated ForceReply 2024-10-07 15:41:23 -04:00
netkas
458ebac946 Updated User 2024-10-07 15:37:11 -04:00
netkas
1930ed5c1c Added Missing PhpDoc 2024-10-07 15:36:08 -04:00
netkas
9a113db0a0 Minor correction 2024-10-07 15:20:30 -04:00
netkas
b2fe2bdec3 Updated MessageEntity 2024-10-07 15:20:19 -04:00
netkas
2b0309cd6d Add constructor and setter methods to ReplyKeyboardMarkup 2024-10-07 13:46:57 -04:00
netkas
b30d70db98 Initialize inline_keyboard array in the constructor 2024-10-07 13:46:49 -04:00
netkas
3b207469bd Expand SendMessageTest with multiple formatting tests 2024-10-07 13:34:14 -04:00
netkas
93b4c68d29 Add setter methods and constructor to ReplyParameters 2024-10-07 13:33:56 -04:00
netkas
77d30bd9bd Add constructor and fluent setters to LinkPreviewOptions 2024-10-07 13:27:48 -04:00
netkas
d04d2b019e Minor correction 2024-10-07 13:04:02 -04:00
netkas
9a3d0b8188 Add setters to LinkPreviewOptions 2024-10-07 13:03:47 -04:00
netkas
b3d26446e6 Make Chat type nullable and default is_forum to false 2024-10-07 13:03:39 -04:00
netkas
7b32ae835e Refactor Bot class to enhance method definitions 2024-10-07 13:03:30 -04:00
netkas
2b0432788c Updated php.xml 2024-10-07 13:02:58 -04:00
netkas
f6a6bff387 Updated SendMessage 2024-10-07 13:02:52 -04:00
netkas
71c9050b88 Added SendMessageTest 2024-10-07 13:02:47 -04:00
netkas
71589e1871 Added GetMeTest 2024-10-07 13:02:41 -04:00
netkas
75acf6aad5 Removed BotTest 2024-10-07 13:02:34 -04:00
netkas
5631201880 Removed GetMeTest 2024-10-07 12:56:19 -04:00
netkas
cd2d070a1a Added ReplyParameters 2024-10-07 12:21:16 -04:00
netkas
286df9b684 Removed old tests 2024-10-07 12:00:37 -04:00
netkas
5e6cc4c827 Minor correction 2024-10-07 11:56:59 -04:00
netkas
96797a17bc Add parameter retrieval methods to bot library 2024-10-07 11:53:39 -04:00
netkas
e4ff11c005 Refactor BotTest to use getMe method 2024-10-07 11:53:25 -04:00
netkas
96cec88e74 Implement method overloading and argument parsing for Bot class 2024-10-07 11:53:16 -04:00
netkas
ac1234d1e5 Updated ncc_workflow.yml 2024-10-07 11:53:07 -04:00
netkas
23aa1ace92 Removed Unused Imports 2024-10-06 19:01:42 -04:00
netkas
49db80523f Add unit tests for Bot class 2024-10-06 19:00:33 -04:00
netkas
a357451a9d Remove unnecessary blank line in GetMeTest setup 2024-10-06 19:00:25 -04:00
netkas
bdcce70ce4 Add PHPDoc annotation for the execute method in Logout 2024-10-06 19:00:17 -04:00
netkas
3b0d131582 Include ObjectTypeInterface in Methods 2024-10-06 19:00:09 -04:00
netkas
c645d6a727 Refactor sendRequest method to use method enums 2024-10-06 18:59:59 -04:00
netkas
5703ce9987 Minor Correction 2024-10-06 18:50:26 -04:00
netkas
220100c4b5 Minor corrections 2024-10-06 16:14:54 -04:00
netkas
bf0b8268de Updated Bot 2024-10-06 16:13:03 -04:00
netkas
0f7e2641e7 Updated WriteAccessAllowed 2024-10-06 16:10:04 -04:00
netkas
3196c357f1 Updated WebhookInfo 2024-10-06 16:09:07 -04:00
netkas
7738851797 Updated WebAppInfo 2024-10-06 16:07:59 -04:00
netkas
a214a7c736 Updated WebAppData 2024-10-06 16:07:30 -04:00
netkas
5557a49e17 Updated Voice 2024-10-06 16:06:58 -04:00
netkas
3564e2a29d Updated VideoNote 2024-10-06 16:06:23 -04:00
netkas
a04140dc8f Updated VideoChatStarted.php 2024-10-06 16:05:05 -04:00
netkas
af6cab91f7 Updated VideoChatScheduled 2024-10-06 16:04:40 -04:00
netkas
40816a586f Updated VideoChatParticipantsInvited 2024-10-06 16:03:52 -04:00
netkas
9a58bf51f4 Updated VideoChatEnded 2024-10-06 16:03:12 -04:00
netkas
d3c5bf4f51 Corrected ChatBoostRemoved 2024-10-06 16:02:02 -04:00
netkas
f72c044df8 Updated project details 2024-10-06 15:59:23 -04:00
netkas
60d2f1b9fd Updated Video 2024-10-06 15:59:18 -04:00
netkas
38657c128d Updated Venue 2024-10-06 15:58:00 -04:00
netkas
fb1be54bb7 Updated USersShared 2024-10-06 15:57:07 -04:00
netkas
2afeada5d5 Updated UserProfilePhotos 2024-10-06 15:54:27 -04:00
netkas
f2dbe173b5 Updated User 2024-10-06 15:53:35 -04:00
netkas
a54ad4bf1e Updated Update 2024-10-06 15:52:13 -04:00
netkas
e8a6e7a6e1 Added ChatBoostSource objects 2024-10-06 15:45:44 -04:00
netkas
3b02d5a5c2 Minor Correction 2024-10-05 01:03:04 -04:00
netkas
63949a2f2f Added BusinessMessagesDeleted 2024-10-05 01:02:54 -04:00
netkas
092e5234a2 Added BusinessConnection 2024-10-05 00:59:01 -04:00
netkas
19333f5876 Updated TextQuote 2024-10-05 00:55:41 -04:00
netkas
af7a33b1c1 Updated Story 2024-10-05 00:55:14 -04:00
netkas
e246741b5a Updated ResponseParameters 2024-10-05 00:54:33 -04:00
netkas
d10e2f7dfc Updated ReplyKeyboardRemove 2024-10-05 00:54:00 -04:00
netkas
f254735b46 Minor Correction 2024-10-05 00:53:23 -04:00
netkas
1cd64da6af Updated ReplyKeyboardMarkup 2024-10-05 00:53:14 -04:00
netkas
af22e993b9 Updated ReactionType 2024-10-05 00:51:54 -04:00
netkas
e5e07fe314 Updated ReactionCount 2024-10-05 00:51:27 -04:00
netkas
6f32bba06e Updated ProximityAlertTriggered 2024-10-05 00:51:10 -04:00
netkas
75fb759100 Updated PollOption 2024-10-05 00:49:53 -04:00
netkas
dba35af7f6 Minor Correction 2024-10-05 00:49:13 -04:00
netkas
5d99aa5e14 Updated PollAnswer 2024-10-05 00:48:55 -04:00
netkas
d0b4a7cf5c Updated Poll 2024-10-05 00:48:07 -04:00
netkas
b19ed2f36d Updated PhotoSize 2024-10-05 00:36:00 -04:00
netkas
0a91098f98 Updated PaidMediaInfo 2024-10-05 00:34:57 -04:00
netkas
6f6cd1d936 Updated MessageReactionCountUpdated 2024-10-05 00:33:54 -04:00
netkas
154dcbe3c6 Updated MessageEntity 2024-10-05 00:33:11 -04:00
netkas
cd84917d8f Updated MessageAutoDeleteTimerChanged 2024-10-05 00:32:01 -04:00
netkas
26162a1a7c Updated LoginUrl 2024-10-05 00:30:16 -04:00
netkas
b2c8877294 Updated Location 2024-10-05 00:29:32 -04:00
netkas
115379e5ab Updated LinkPreviewOptions 2024-10-05 00:28:45 -04:00
netkas
aa62427906 Updated KeyboardButtonRequestUser 2024-10-05 00:27:47 -04:00
netkas
adbf591b2e Updated KeyboardButtonRequestChat 2024-10-05 00:26:56 -04:00
netkas
63970f807e Updated KeyboardButtonPollType 2024-10-05 00:24:58 -04:00
netkas
3746009e4e Updated KeyboardButton 2024-10-05 00:20:16 -04:00
netkas
35c9710d3f Updated InlineKeyboardMarkup 2024-10-05 00:18:09 -04:00
netkas
d56654a512 Updated InlineKeyboardButton 2024-10-05 00:17:34 -04:00
netkas
4558409da5 Updated Messages 2024-10-04 21:21:30 -04:00
netkas
6280b8c026 Updated GiveawayWinners 2024-10-04 21:19:51 -04:00
netkas
0fedf2cc54 Updated GiveawayCreated 2024-10-04 21:19:12 -04:00
netkas
89d0165fb6 Updated GiveawayCompleted 2024-10-04 21:18:44 -04:00
netkas
0a411cec79 Updated Giveaway 2024-10-04 21:18:02 -04:00
netkas
c22ef6e2ff Updated GeneralForumTopicUnhidden 2024-10-04 21:17:18 -04:00
netkas
f7a6df10df Updated GeneralForumTopicHidden 2024-10-04 21:16:48 -04:00
netkas
89e3f9c575 Updated ForumTopicReopened 2024-10-04 21:16:13 -04:00
netkas
8d074ef36a Updated ForumTopicEdited 2024-10-04 21:15:28 -04:00
netkas
926ab06c51 Minor Correction 2024-10-04 21:14:41 -04:00
netkas
2f6a39d863 Updated ForumTopicCreated 2024-10-04 21:14:23 -04:00
netkas
6aa95f305a Updated ForumTopicClosed 2024-10-04 21:13:32 -04:00
netkas
c1eec26a2c Updated ForumTopic 2024-10-04 21:12:50 -04:00
netkas
d386d1a553 Minor Correction 2024-10-04 21:12:24 -04:00
netkas
ce22cb4b0a Updated ForceReply 2024-10-04 21:11:26 -04:00
netkas
e12979d7af Updated File 2024-10-04 21:09:36 -04:00
netkas
c546a44b78 Updated Stickers 2024-10-04 21:08:22 -04:00
netkas
f966d6809f Updated Game object 2024-10-04 19:56:31 -04:00
netkas
6f75038bf5 Updated Passport objects 2024-10-04 19:54:04 -04:00
netkas
eef9ab5624 Added TransactionPartner object 2024-10-04 19:48:00 -04:00
netkas
07140aa08f Added RevenueWithdrawalState objects 2024-10-04 15:44:37 -04:00
netkas
6839980fdb Added PaidMediaPurchased 2024-10-04 15:25:14 -04:00
netkas
c4d7fc0f41 Updated PreCheckoutQuery 2024-10-04 15:23:05 -04:00
netkas
ac8b629dc5 Updated ShippingQuery 2024-10-04 15:21:37 -04:00
netkas
20cd2aeacf Updated RefundedPayment 2024-10-04 15:20:14 -04:00
netkas
22eeeca427 Updated SuccessfulPayment 2024-10-04 15:19:44 -04:00
netkas
7f7f353ed5 Updated ShippingOption 2024-10-04 15:18:43 -04:00
netkas
147e4141b9 Updated OrderInfo 2024-10-04 15:16:57 -04:00
netkas
f20f86a2fb Updated ShippingAddress 2024-10-04 15:15:56 -04:00
netkas
fdf6e3addc Updated Invoice 2024-10-04 15:15:00 -04:00
netkas
196d4a063c Updated LabeledPrice 2024-10-04 15:14:02 -04:00
netkas
a84b20e0fb Moved Game objects 2024-10-04 15:12:35 -04:00
netkas
6c9af0b1d8 Moved Stickers 2024-10-04 15:11:50 -04:00
netkas
0b8603ec75 Moved Passport objects 2024-10-04 15:10:22 -04:00
netkas
02dedd3e03 Moved Payment objects 2024-10-04 15:09:07 -04:00
netkas
0662c64ed6 Updated Document 2024-10-04 15:05:43 -04:00
netkas
7dce9a5f8e Updated Dice 2024-10-04 15:04:16 -04:00
netkas
3eae8f43c8 Updated Currency 2024-10-04 15:03:36 -04:00
netkas
1aec926fd6 Updated Contact 2024-10-04 15:02:28 -04:00
netkas
746201b395 Updated ChatShared 2024-10-04 15:01:33 -04:00
netkas
bc1000fa1d Updated ChatPhoto 2024-10-04 15:00:51 -04:00
netkas
108f64d924 Updated ChatPermissions 2024-10-04 15:00:02 -04:00
netkas
7fdfce0cc6 Updated ChatMemberUpdated 2024-10-04 14:58:42 -04:00
netkas
7b54b8572d Updated ChatLocation 2024-10-04 14:56:02 -04:00
netkas
741356c5b5 Removed Unused type comment 2024-10-04 14:07:46 -04:00
netkas
0272c7b3ed Updated ChatJoinRequest 2024-10-04 14:05:45 -04:00
netkas
65845b53de Updated ChatInviteLink 2024-10-04 14:02:35 -04:00
netkas
e894375aae Added ChatFullInfo 2024-10-04 13:58:11 -04:00
netkas
f331ab7ede Added MessageReactionCountUpdated 2024-10-04 13:36:18 -04:00
netkas
11b3fbc6a7 Minor correction 2024-10-04 13:31:38 -04:00
netkas
ef06cf4afb Added MessageReactionUpdated 2024-10-04 13:31:08 -04:00
netkas
742f177145 Added ReactionCount 2024-10-04 13:26:07 -04:00
netkas
ba5e446bd2 Added ReactionType objects 2024-10-04 13:23:54 -04:00
netkas
18ba52b376 Added BusinessOpeningHours 2024-10-04 13:03:40 -04:00
netkas
94119c461c Added BusinessOpeningHoursInterval 2024-10-04 12:53:44 -04:00
netkas
f0982e0c3a Added BusinessLocation 2024-10-04 12:51:52 -04:00
netkas
7bf5939a07 Added BusinessIntro 2024-10-04 12:38:08 -04:00
netkas
1ad1ac969b Updated Chat 2024-10-04 12:29:29 -04:00
netkas
17ceeeda5a Added Birthdate 2024-10-04 12:29:19 -04:00
netkas
6c2219f1ae Minor corrections 2024-10-04 12:14:32 -04:00
netkas
7d9caf38b3 Updated CallbackQuery 2024-10-04 12:14:23 -04:00
netkas
f6df3bf9da Updated CallbackGame 2024-10-04 12:10:25 -04:00
netkas
d2f283afdd Updated BotShortDescription 2024-10-04 12:08:57 -04:00
netkas
16b4ba587b Update BotDescription 2024-10-04 12:08:31 -04:00
netkas
6e7536e3c4 Updated BotCommandScope 2024-10-04 12:08:01 -04:00
netkas
fd2f55eb90 Updated BotCommand 2024-10-04 12:07:43 -04:00
netkas
5cddbc44d8 Updated BackgroundFill 2024-10-04 12:05:06 -04:00
netkas
68bb270dc1 Updated Audio 2024-10-04 12:04:33 -04:00
netkas
cade220d0a Updated Animation 2024-10-04 00:50:36 -04:00
netkas
46d6cdf124 Updated PaidMedia objects 2024-10-04 00:48:28 -04:00
netkas
2405873510 Updated MessageOrigin objects 2024-10-04 00:47:04 -04:00
netkas
5426dd9e1c Updated MenuButton objects 2024-10-04 00:45:09 -04:00
netkas
3774b7f8c0 Updated InputMedia objects 2024-10-04 00:36:07 -04:00
netkas
1d11ef3b2a Updated SentWebAppMessage 2024-10-04 00:20:30 -04:00
netkas
f5dc29804c Updated PhpDoc 2024-10-04 00:20:16 -04:00
netkas
e8221c11ec Updated ObjectTypeInterface 2024-10-04 00:19:53 -04:00
netkas
fe1fd3083b Updated InlineQuery 2024-10-04 00:18:19 -04:00
netkas
ad1094de38 Updated ChosenInlineResult 2024-10-04 00:16:11 -04:00
netkas
aaacd8851e Updated InputMessageContent objects 2024-10-04 00:14:47 -04:00
netkas
9dd11af87d Refactor array handling and InputMedia class structure 2024-10-03 21:31:04 -04:00
netkas
3ed338d49a Corrected BackgroundTypeFill.php 2024-10-03 21:18:55 -04:00
netkas
0395f3d32a Moved InlineKeyboardMarkup & InlineKeyboardButton 2024-10-03 21:18:35 -04:00
netkas
4c0ad925d7 Moved InputMessageContent objects 2024-10-03 21:17:09 -04:00
netkas
fb2a06024d Moved InputMessageContent 2024-10-03 21:15:51 -04:00
netkas
dfb812237b Updated classes fromArray signatures (in-progress) 2024-10-03 21:14:35 -04:00
netkas
59f6875edf Updated .gitignore 2024-10-03 19:56:40 -04:00
netkas
73de7d82f0 Updated BotOld (for now) 2024-10-03 19:56:29 -04:00
netkas
1625a1d829 Updated Update 2024-10-03 19:56:15 -04:00
netkas
b1e9753b58 Moved SentWebAppMessage.php 2024-10-03 19:56:11 -04:00
netkas
aa80be21d0 Moved ChosenInlineResult 2024-10-03 19:56:04 -04:00
netkas
c66d5ebe1b Updated Message object 2024-10-03 19:55:54 -04:00
netkas
669ec19f46 Updated InlineQuery objects 2024-10-03 19:55:48 -04:00
netkas
58849813e9 Updated InputMessageContent objects 2024-10-03 00:45:23 -04:00
netkas
6a7668c427 Updated ChatMember object 2024-10-02 15:04:29 -04:00
netkas
b14dd43eb7 Minor correction 2024-10-02 00:33:20 -04:00
netkas
79278e7748 Updated BotCommandScope 2024-10-02 00:32:13 -04:00
netkas
6c67e97a4b Moved Objects 2024-10-02 00:18:12 -04:00
netkas
848a2a78e3 Updated Message object 2024-10-01 21:41:27 -04:00
netkas
8ee69052b1 Renamed UserShared to UsersShared 2024-10-01 15:19:10 -04:00
netkas
285a8fe8b8 Added GiveawayCompleted 2024-10-01 14:07:53 -04:00
netkas
93e408be17 Added GiveawayCreated 2024-10-01 13:00:53 -04:00
netkas
3691445841 Updated PaidMedia 2024-10-01 12:47:55 -04:00
netkas
811d2c6d4a Added TextQuote 2024-10-01 12:44:26 -04:00
netkas
85a22771b4 Added RefundedPayment 2024-10-01 12:44:04 -04:00
netkas
b144627a70 Added InaccessibleMessage 2024-10-01 12:43:44 -04:00
netkas
dfe522d965 Added MaybeInaccessibleMessage 2024-10-01 12:43:28 -04:00
netkas
054f76d144 Added ChatBoostAdded 2024-10-01 12:42:52 -04:00
netkas
088eac6b88 Added ChatBackground 2024-10-01 12:41:46 -04:00
netkas
c2ba0bf68e Add BackgroundType objects 2024-10-01 12:41:37 -04:00
netkas
649004a844 Add BackgroundFill objects 2024-10-01 12:41:28 -04:00
netkas
eb15ca3ee9 Added ExternalReplyInfo object 2024-09-30 15:16:53 -04:00
netkas
c0146c97ab Added GiveawayWinners object 2024-09-30 15:02:55 -04:00
netkas
8a7df394f0 Added Giveaway object 2024-09-30 15:02:40 -04:00
netkas
aae9e737da Added Story object 2024-09-30 14:09:29 -04:00
netkas
b256812da6 Added PaidMediaInfo Object 2024-09-30 14:03:29 -04:00
netkas
cb383d3183 Correction in CHANGELOG.md 2024-09-30 13:46:46 -04:00
netkas
a4bc96d00b Added PaidMedia, PaidMediaPhoto, PaidMediaPreview, PaidMediaVideo & PaidMediaType Enum 2024-09-30 13:45:38 -04:00
netkas
b3b3302f00 Updated CHANGELOG.md 2024-09-30 13:16:06 -04:00
netkas
ac603b1635 Add LinkPreviewOptions class 2024-09-30 13:13:07 -04:00
netkas
c4c307fcf1 Add message origin classes 2024-09-30 13:04:23 -04:00
netkas
1e3824a87a Updated Methods 2024-09-30 12:22:12 -04:00
netkas
67230e35ba Add Logout method 2024-09-30 12:22:06 -04:00
netkas
9c4e964a15 Add Close method 2024-09-30 12:22:02 -04:00
netkas
1720455918 Add execute method to Methods enum 2024-09-30 02:48:39 -04:00
netkas
b37eeaf09c Added 'can_connect_to_business' & 'has_main_web_app' 2024-09-30 02:39:28 -04:00
netkas
fb381c5138 Add GetMe method to TgBotLib 2024-09-30 02:35:54 -04:00
netkas
3dd46c8d27 Update bot token handling and refactor Bot class. 2024-09-30 02:35:42 -04:00
netkas
20735b36db Update bot initialization to BotOld; configure PHPUnit 2024-09-30 02:35:30 -04:00
netkas
17e31c9bce Update interface method signatures to use BotOld 2024-09-30 02:35:17 -04:00
netkas
1231e7d387 Add StartCommand and update HashCommand to use BotOld 2024-09-30 02:35:01 -04:00
netkas
ee5f204fc1 Updated .gitignore 2024-09-30 02:34:36 -04:00
netkas
46167099bf Remove StartCommand test file 2024-09-30 02:34:17 -04:00
netkas
7aa6be4e9a Add unit tests and abstract bot method execution framework 2024-09-30 02:34:07 -04:00
netkas
69f7ff6a5a Moved Bot to BotOld 2024-09-30 02:33:48 -04:00
netkas
55e65e8948 Moved Types to their own namespace 2024-09-29 21:49:10 -04:00
netkas
2f701a899f Updated CHANGELOG.md 2024-09-29 21:47:42 -04:00
netkas
323c3531ba Refactor enums to use native PHP 8.1 syntax 2024-09-29 21:46:55 -04:00
netkas
eac0490ae8 Bumped version to 7.10.0 2024-09-29 21:40:43 -04:00
netkas
3e035e5d7d Updated .gitignore 2024-09-29 21:36:43 -04:00
netkas
ae61b3fadf Add CI workflow and update build configurations 2024-09-29 21:36:05 -04:00
a9b314879a
Bumped version to 6.7.1 2023-08-13 21:11:42 -04:00
8c664e8127
* Updated \TgBotLib\Bot::sendPhoto() to accept URLs as a parameter for the photo field.
* Updated `\TgBotLib\Bot::sendAudio()` to accept URLs as a parameter for the `audio` field.
 * Updated `\TgBotLib\Bot::sendDocument()` to accept URLs as a parameter for the `document` field.
 * Updated `\TgBotLib\Bot::sendVideo()` to accept URLs as a parameter for the `video` field.
 * Updated `\TgBotLib\Bot::sendAnimation()` to accept URLs as a parameter for the `animation` field.
 * Updated `\TgBotLib\Bot::sendVoice()` to accept URLs as a parameter for the `voice` field.
2023-08-13 21:11:32 -04:00
0dbf477f7b
Merge branch 'master' into dev 2023-08-10 14:32:04 -04:00
ada7676ef9
Updated CI 2023-08-10 14:27:20 -04:00
db38d46fb3
Updated CHANGELOG.md 2023-08-10 14:25:22 -04:00
54e81b4137
* Fixed type in \TgBotLib\Objects\Telegram > Message > fromArray() where forum_topic_created is being parsed for forum_topic_edited instead of forum_topic_edited
Updated README.md to reflect the new changes with TamerLib 2.+
2023-08-10 14:25:05 -04:00
fbc472d8de
Updated method \TgBotLib > Bot > handleGetUpdates() to handle exceptions 2023-08-09 20:02:59 -04:00
8a4dfddae6
Minor correction 2023-08-09 19:52:35 -04:00
857d20774d
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultVoice.php 2023-08-09 19:51:47 -04:00
1b4e4a806f
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultVideo.php 2023-08-09 19:47:03 -04:00
1deb1aaa6c
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultVenue 2023-08-09 19:40:37 -04:00
77ce3969aa
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultPhoto 2023-08-09 19:24:18 -04:00
a1ec9fdb13
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultMpeg4Gif 2023-08-09 18:52:00 -04:00
96c3e190cb
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultLocation 2023-08-09 18:25:42 -04:00
8e45540d78
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultLocation 2023-08-09 17:49:27 -04:00
ddf897f143
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultGif 2023-08-09 17:47:02 -04:00
d80637250d
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultGif 2023-08-09 17:39:37 -04:00
32f089203a
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultGame 2023-08-09 17:31:12 -04:00
7573fc2205
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultContact 2023-08-09 15:45:59 -04:00
b81fa4fa4f
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultAudio 2023-08-09 15:41:55 -04:00
3d99e58d25
Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultArticle 2023-08-09 15:35:18 -04:00
5ec6f7271a
* Renamed namespace from \TgBotLib\Abstracts to \TgBotLib\Enums
* Updated class type to `final class` in `\TgBotLib\Enums > BotCommandScopeType`
 * Updated class type to `final class` in `\TgBotLib\Enums >  ChatActionType`
 * Updated class type to `final class` in `\TgBotLib\Enums > ChatMemberStatus`
 * Updated class type to `final class` in `\TgBotLib\Enums > ChatType`
 * Updated class type to `final class` in `\TgBotLib\Enums > EventType`
 * Updated class type to `final class` in `\TgBotLib\Enums > InlineQueryResultType`
 * Updated class type to `final class` in `\TgBotLib\Enums > InputMediaType`
 * Updated class type to `final class` in `\TgBotLib\Enums > InputButtonType`
 * Updated class type to `final class` in `\TgBotLib\Enums > MessageEntityType`
 * Updated class type to `final class` in `\TgBotLib\Enums > PassportElementType`
 * Updated class type to `final class` in `\TgBotLib\Enums > PollType`
 * Updated class type to `final class` in `\TgBotLib\Enums > StickerFormat`
 * Updated class type to `final class` in `\TgBotLib\Enums > StickerType`
 * Updated class type to `final class` in `\TgBotLib\Enums > ThumbnailMimeType`
 * Updated class type to `final class` in `\TgBotLib\Enums > UpdateEventType`
2023-08-09 15:32:45 -04:00
176ea791bf
Added set methods to \TgBotLib\Objects\Telegram\InputMessageContent\InputVenueMessageContent
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-30 15:24:47 -04:00
40d25a15f1
Added set methods to \TgBotLib\Objects\Telegram\InputMessageContent\InputTextMessageContent
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-30 14:01:51 -04:00
5ce6f737f5 Added set methods to \TgBotLib\Objects\Telegram\InputMessageContent\InputLocationMessageContent
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 23:48:29 -04:00
2389839a37 Removed unused 'CurrencyNotSupportedException'
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 20:43:30 -04:00
3c91058235 Implemented Telegram's currency API \TgBotLib\Classes\Utilities::getCurrency to get basic information about the currency of the specified country, see [Telegram's currency API](https://core.telegram.org/bots/payments) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 20:42:11 -04:00
e025f34a2e Merge remote-tracking branch 'github/dev' into dev 2023-04-27 16:18:41 -04:00
d0219425c1 Added new methods to \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent
- \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setTitle
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setDescription
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPayload
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setProviderToken
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setCurrency
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::addPrice
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::clearPrices
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setMaxTipAmount
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSuggestionsTipAmounts
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setProviderData
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoUrl
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoSize
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoWidth
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoHeight
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedName
 - jetbrains://php-storm/navigate/reference?project=tgbot&fqn=\TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedPhoneNumber
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedEmail
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedShippingAddress
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSendPhoneNumberToProvider
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSendEmailToProvider
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setIsFlexible

Renamed \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::isIsFlexible to \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::isFlexible

https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 16:18:29 -04:00
b8d3a20a5c Added new methods to \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent
- \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setTitle
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setDescription
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPayload
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setProviderToken
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setCurrency
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::addPrice
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::clearPrices
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setMaxTipAmount
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSuggestionsTipAmounts
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setProviderData
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoUrl
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoSize
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoWidth
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoHeight
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedName
 - jetbrains://php-storm/navigate/reference?project=tgbot&fqn=\TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedPhoneNumber
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedEmail
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedShippingAddress
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSendPhoneNumberToProvider
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSendEmailToProvider
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setIsFlexible

Renamed \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::isIsFlexible to \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::isFlexible

https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 16:18:16 -04:00
4ce61e5af7 Added new methods to \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent
- \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setTitle
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setDescription
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPayload
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setProviderToken
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setCurrency
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::addPrice
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::clearPrices
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setMaxTipAmount
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSuggestionsTipAmounts
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setProviderData
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoUrl
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoSize
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoWidth
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setPhotoHeight
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedName
 - jetbrains://php-storm/navigate/reference?project=tgbot&fqn=\TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedPhoneNumber
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedEmail
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setNeedShippingAddress
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSendPhoneNumberToProvider
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setSendEmailToProvider
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::setIsFlexible

Renamed \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::isIsFlexible to \TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent::isFlexible

https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 16:17:36 -04:00
26c0a197dc Updated documentation for \TgBotLib\Bot::editMessageMedia
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 14:49:42 -04:00
3d6cc15894 Added method \TgBotLib\Bot::answerWebAppQuery to answer a callback query sent from a web app, which returns the newly added \TgBotLib\Objects\Telegram\SentWebAppMessage object on success.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 14:32:32 -04:00
581fa42715 Refactored \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent and added
- \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setPhoneNumber
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setFirstName
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setLastName
 - \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setVcard

https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-27 14:23:14 -04:00
e463b81948 Refactored CHANGELOG.md
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 19:23:17 -04:00
bcbb742b9f Added class \TgBotLib\Objects\Telegram\InlineQueryResult which is the base class for all inline query results, additionally added \TgBotLib\Abstracts\InlineQueryResultType to represent the type of inline query result object.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 19:22:06 -04:00
6fb6f74406 Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGame, see [InlineQueryResultGame](https://core.telegram.org/bots/api#inlinequeryresultgame) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 19:14:36 -04:00
c0b25c7b0e Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultContact, see [InlineQueryResultContact](https://core.telegram.org/bots/api#inlinequeryresultcontact) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 19:10:04 -04:00
22a99eb06a Minoe change 2023-04-24 16:27:05 -04:00
61249cb18d Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVenue, see [InlineQueryResultVenue](https://core.telegram.org/bots/api#inlinequeryresultvenue) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 16:15:03 -04:00
89b240f2eb Minor correction by renaming fields thumb_* to thumbnail_
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 14:31:01 -04:00
144095b228 Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultLocation, see [InlineQueryResultLocation](https://core.telegram.org/bots/api#inlinequeryresultlocation) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 14:27:23 -04:00
05b877d38a Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultDocument, see [InlineQueryResultDocument](https://core.telegram.org/bots/api#inlinequeryresultdocument) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-24 14:01:22 -04:00
9deb9e2c00 Minor correction in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultVoice 2023-04-24 13:47:50 -04:00
d14ee4eae4 Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVoice, see [InlineQueryResultVoice](https://core.telegram.org/bots/api#inlinequeryresultvoice) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-23 20:49:24 -04:00
c3ecb75d6c Added constructors to InlineQuery objects 2023-04-23 20:40:53 -04:00
51cce667f7 Updated README.md with more information on how to install NCC 2023-04-23 20:28:35 -04:00
b1db812097 Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultAudio, see [InlineQueryResultAudio](https://core.telegram.org/bots/api#inlinequeryresultaudio) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-23 20:25:33 -04:00
41c1d0fc4c Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVideo, see [InlineQueryResultVideo](https://core.telegram.org/bots/api#inlinequeryresultvideo) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-23 18:58:24 -04:00
277a33f2d3 Added field via_chat_folder_invite_link to \TgBotLib\Objects\Telegram\ChatMemberUpdated to represent the invite link, which was used by the user to join the chat; for joining by invite link events only.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-23 18:40:37 -04:00
67b7b68b4c Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultMpeg4Gif, see [InlineQueryResultMpeg4Gif](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif) for more information. 2023-04-23 18:36:34 -04:00
1707a44796 Added abstract class \TgBotLib\Abstracts\ThumbnailMimeType to represent the mime type of thumbnail, photo, or a file / sticker thumbnail. 2023-04-23 18:24:42 -04:00
01399f0723 Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGif, see [InlineQueryResultGif](https://core.telegram.org/bots/api#inlinequeryresultgif) for more information. 2023-04-23 18:24:04 -04:00
79446bfcbd Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultPhoto, see [InlineQueryResultPhoto](https://core.telegram.org/bots/api#inlinequeryresultphoto) for more information. 2023-04-23 18:02:54 -04:00
f518ca0030 Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultArticle, see [InlineQueryResultArticle](https://core.telegram.org/bots/api#inlinequeryresultarticle) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
2023-04-23 17:46:09 -04:00
8ca48b008e Updated CHANGELOG.md 2023-04-23 17:37:31 -04:00
b2928875cd Added methods \TgBotLib\Classes\Validate::url, \TgBotLib\Classes\Validate::length, & \TgBotLib\Classes\Validate::isHttps to \TgBotLib\Classes\Validate 2023-04-23 17:34:35 -04:00
f8c02bceb3 Added methods \TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow & \TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow to \TgBotLib\Objects\Telegram\InlineKeyboardMarkup 2023-04-23 17:33:26 -04:00
6a4128090c Added methods \TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow & \TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow to \TgBotLib\Objects\Telegram\InlineKeyboardMarkup 2023-04-23 16:53:35 -04:00
7970313d88 Added methods \TgBotLib\Objects\Telegram\InlineKeyboardButton::setUrl, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setText, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackData,\TgBotLib\Objects\Telegram\InlineKeyboardButton::setWebApp, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setLoginUrl, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQuery, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQueryCurrentChat \TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackGame, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setPay to \TgBotLib\Objects\Telegram\InlineKeyboardButton 2023-04-23 16:52:40 -04:00
841d4ff11d Updated CHANGELOG.md 2023-04-23 16:22:31 -04:00
269baf7d26 Refactored InputMessageContent types to it's own namespace so InputMessageContent can always return the correct InputMessageContent object type when calling fromArray() 2023-04-23 16:22:15 -04:00
9ffc0a2105 Added new exception class NotImplementedException to represent the case when a method is not implemented yet or the method is not applicable to the current object. 2023-04-23 16:20:41 -04:00
f54c30b320 Added object \TgBotLib\Objects\Telegram > InputInvoiceMessageContent to represent the content of an invoice message to be sent as the result of an inline query. 2023-04-23 15:45:42 -04:00
1b569e4972 Added object \TgBotLib\Objects\Telegram > InputContactMessageContent to represent the content of a contact message to be sent as the result of an inline query. 2023-04-23 15:02:03 -04:00
ec93f9ffd7 Added object \TgBotLib\Objects\Telegram > InputVenueMessageContent to represent the content of a venue message to be sent as the result of an inline query. 2023-04-23 14:57:44 -04:00
ce94585752 Added object \TgBotLib\Objects\Telegram > InputLocationMessageContent to represent the content of a location message to be sent as the result of an inline query. 2023-04-23 14:48:55 -04:00
ac27d427e1 Minor correction in CHANGELOG.md 2023-04-23 14:43:15 -04:00
ed41bcea2f Added object \TgBotLib\Objects\Telegram > InputTextMessageContent to represent the content of a text message to be sent as the result of an inline query. 2023-04-23 14:42:51 -04:00
18a3c7ef6f Bumped version to 6.7.0 2023-04-23 13:33:29 -04:00
Netkas
ad83558169 Merge branch 'dev' 2023-04-10 21:00:20 -04:00
Netkas
949017a123 Updated CHANGELOG.md 2023-04-10 21:00:11 -04:00
Netkas
b3b66a2634 Merge branch 'master' of https://git.n64.cc/nosial/libs/tgbot 2023-04-10 20:59:32 -04:00
Netkas
fb1a844526 Added method \TgBotLib\Bot > setStickerMaskPosition() to change the mask position of a mask sticker. See [setStickerMaskPosition](https://core.telegram.org/bots/api#setstickermaskposition) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 20:58:16 -04:00
Netkas
54fc17b549 Added method \TgBotLib\Bot > setStickerKeywords() to set the list of emojis for a sticker set. See [setStickerKeywords](https://core.telegram.org/bots/api#setstickerkeywords) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 20:56:03 -04:00
Netkas
174210da67 Added method \TgBotLib\Bot > setStickerEmojiList() to set the list of emojis for a sticker set. See [setStickerEmojiList](https://core.telegram.org/bots/api#setstickeremojilist) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 20:50:50 -04:00
Netkas
d171c61e7f Added method \TgBotLib\Bot > deleteStickerSet() to delete a sticker set. See [deleteStickerSet](https://core.telegram.org/bots/api#deletestickerset) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 20:48:06 -04:00
Netkas
5283416292 Added method \TgBotLib\Bot > setStickerSetTitle() to set the title of a sticker set. See [setStickerSetTitle](https://core.telegram.org/bots/api#setstickersettitle) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 20:34:14 -04:00
Netkas
917077c19a Added method \TgBotLib\Bot > setStickerSetThumbnail() to set the thumbnail of a sticker set. See [setStickerSetThumbnail](https://core.telegram.org/bots/api#setstickersetthumbnail) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 19:42:14 -04:00
Netkas
b4e0f62e99 Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 19:38:06 -04:00
Netkas
97fe1f33ad Renamed thumb field in TgBotLib\Objects\Telegram > VideoNote to thumbnail
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 19:21:05 -04:00
Netkas
da8108c196 Renamed thumb field in TgBotLib\Objects\Telegram > Video to thumbnail
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 19:16:50 -04:00
Netkas
70c6181cd8 Renamed thumb field in TgBotLib\Objects\Telegram > Sticker to thumbnail & Fixed TgBotLib\Objects\Telegram > Sticker > toArray() to properly return the premium_animation field 2023-04-10 19:13:27 -04:00
Netkas
3ae16b96e1 Renamed thumb field in TgBotLib\Objects\Telegram > Document to thumbnail
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 19:06:19 -04:00
Netkas
688ea4f5b1 Updated php.xml 2023-04-10 19:04:41 -04:00
Netkas
c6caabfcb4 Minor correction 2023-04-10 19:04:24 -04:00
Netkas
af8fabceaa Renamed thumb field in TgBotLib\Objects\Telegram > Audio to thumbnail
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 19:03:05 -04:00
Netkas
4d3ba7004e Renamed thumb field in TgBotLib\Objects\Telegram > Animation to thumbnail
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 17:47:33 -04:00
Netkas
007304c8ca Added method \TgBotLib\Bot > setCustomEmojiStickerSetThumbnail() to set the thumbnail of a sticker set. See [setCustomEmojiStickerSetThumbnail](https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 17:43:37 -04:00
Netkas
595872c997 Added method \TgBotLib\Bot > uploadStickerFile() to upload a sticker file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). See [uploadStickerFile](https://core.telegram.org/bots/api#uploadstickerfile) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 17:39:34 -04:00
Netkas
4dc5e9e20d Added abstract class \TgBotLib\Abstracts > StickerFormat to represent a sticker format ("static", "animated" or "video")
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 17:37:43 -04:00
Netkas
37a136adce Added method \TgBotLib\Bot > addStickerToSet() to add a new sticker to a set created by the bot. See [addStickerToSet](https://core.telegram.org/bots/api#addstickertoset) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 16:10:19 -04:00
Netkas
65564ecb2a Added the field _needs_repainting_ to the [Sticker](https://core.telegram.org/bots/api#sticker) class which can be obtained via TgBotLib\Objects\Telegram > Sticker > needsRepainting()
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
2023-04-10 16:05:37 -04:00
Netkas
c17773e5d2 Added method \TgBotLib\Bot > createNewStickerSet() to create a new sticker set owned by a user. See [createNewStickerSet](https://core.telegram.org/bots/api#createnewstickerset) for more information. 2023-04-07 01:37:01 -04:00
Netkas
8965ac3aff Added method \TgBotLib\Bot > sendSticker() to send a sticker to a chat. See [sendSticker](https://core.telegram.org/bots/api#sendsticker) for more information. 2023-04-06 13:54:48 -04:00
Netkas
38012104ae Added the ability to get the current bot short description in the given language as the class [BotShortDescription](https://core.telegram.org/bots/api#botshortdescription) using the method \TgBotLib\Bot > getMyShortDescription() see [getMyShortDescription](https://core.telegram.org/bots/api#getmyshortdescription) for more information. 2023-04-06 13:47:53 -04:00
Netkas
5c1bb7c936 Minor change in CHANGELOG.md 2023-04-06 13:46:03 -04:00
Netkas
4869c439ff Minor corrections to the PhpDoc in \TgBotLib > Bot > getMyDescription 2023-04-06 13:40:39 -04:00
Netkas
8730f82abf Added the ability to set different bot short descriptions for different user languages using the method \TgBotLib\Bot > setMyShortDescription() see [setMyShortDescription](https://core.telegram.org/bots/api#setmyshortdescription) for more information. 2023-04-06 13:39:51 -04:00
Netkas
ccd910938b Added the ability to get the current bot description in the given language as the class [BotDescription](https://core.telegram.org/bots/api#botdescription) using the method \TgBotLib\Bot > getMyDescription() 2023-04-06 13:33:29 -04:00
Netkas
7252854c44 Added the ability to set different bot descriptions for different user languages using the method \TgBotLib\Bot > setMyDescription() 2023-04-06 13:22:09 -04:00
Netkas
855925d4bd Bumped version to 6.6.0 2023-04-06 13:17:33 -04:00
Administrator
fb2f7dc94e Merge branch 'master' into 'master'
Some fixes in docs

See merge request nosial/libs/tgbot!2
2023-03-08 01:34:17 +00:00
Administrator
711990af3c Merge branch 'dev' into 'master'
Minor doc fixes in dev branch

See merge request nosial/libs/tgbot!1
2023-03-08 01:31:43 +00:00
Cybersecbyte [UFOLINUX]
e7b9947094 fixes for docs in dev branch 2023-03-07 08:13:47 +00:00
Cybersecbyte [UFOLINUX]
6c8a919a2a Some fixes in docs 2023-03-07 08:12:02 +00:00
Netkas
bfa19191a2 Merge remote-tracking branch 'origin/dev' into dev 2023-03-01 19:15:09 -05:00
Netkas
d06f012797 Updated Run Configurations 2023-03-01 19:14:58 -05:00
Netkas
72a09a2663 Updated CHANGELOG.md 2023-03-01 19:14:35 -05:00
Netkas
ffe62c1ae2 Updated CHANGELOG.md 2023-02-28 22:19:59 -05:00
Netkas
2e1f699e29 Bumped version to 6.5.4 2023-02-28 22:19:16 -05:00
Netkas
cc22e23a06 Removed unused destruct() 2023-02-28 22:18:43 -05:00
Netkas
2a0ba0eaf7 Bumped version 2023-02-28 21:16:28 -05:00
Netkas
7aa24bea13 Updated CHANGELOG.md 2023-02-28 21:06:05 -05:00
Netkas
7be37db679 Added \TgBotLib\Objects\Telegram > Poll 2023-02-28 21:04:00 -05:00
493 changed files with 31508 additions and 10693 deletions

555
.github/workflows/ncc_workflow.yml vendored Normal file
View file

@ -0,0 +1,555 @@
name: CI
on:
push:
branches:
- '**'
release:
types: [created]
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
container:
image: php:8.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Build project
run: |
ncc build --config release --build-source --log-level debug
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: release
path: build/release/net.nosial.tgbotlib.ncc
release-compressed:
runs-on: ubuntu-latest
container:
image: php:8.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Build project
run: |
ncc build --config release-compressed --build-source --log-level debug
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: release-compressed
path: build/release/net.nosial.tgbotlib.gz.ncc
release-executable:
runs-on: ubuntu-latest
container:
image: php:8.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Build project
run: |
ncc build --config release-executable --build-source --log-level debug
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: release-executable
path: build/release/TgBotLib
release-executable-compressed:
runs-on: ubuntu-latest
container:
image: php:8.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Build project
run: |
ncc build --config release-executable-compressed --build-source --log-level debug
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: release-executable-compressed
path: build/release/TgBotLib_gz
debug:
runs-on: ubuntu-latest
container:
image: php:8.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Build project
run: |
ncc build --config debug --build-source --log-level debug
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: debug
path: build/debug/net.nosial.tgbotlib.ncc
debug-compressed:
runs-on: ubuntu-latest
container:
image: php:8.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Build project
run: |
ncc build --config debug-compressed --build-source --log-level debug
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: debug-compressed
path: build/debug/net.nosial.tgbotlib.gz.ncc
# Checking for phpunit.xml
check-phpunit:
runs-on: ubuntu-latest
outputs:
phpunit-exists: ${{ steps.check.outputs.phpunit-exists }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check for phpunit.xml
id: check
run: |
if [ -f phpunit.xml ]; then
echo "phpunit-exists=true" >> $GITHUB_OUTPUT
else
echo "phpunit-exists=false" >> $GITHUB_OUTPUT
fi
# Checking for phpdoc.dist.xml
check-phpdoc:
runs-on: ubuntu-latest
outputs:
phpdoc-exists: ${{ steps.check.outputs.phpdoc-exists }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check for phpdoc.dist.xml
id: check
run: |
if [ -f phpdoc.dist.xml ]; then
echo "phpdoc-exists=true" >> $GITHUB_OUTPUT
else
echo "phpdoc-exists=false" >> $GITHUB_OUTPUT
fi
generate-phpdoc:
needs: [release, check-phpdoc]
runs-on: ubuntu-latest
container:
image: php:8.3
if: needs.check-phpdoc.outputs.phpdoc-exists == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
- name: Download PHPDocumentor
run: |
wget https://phpdoc.org/phpDocumentor.phar
chmod +x phpDocumentor.phar
- name: Generate PHPDoc
run: |
php phpDocumentor.phar -d src -t docs
- name: Archive PHPDoc
run: |
zip -r docs.zip docs
- name: Upload PHPDoc
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs.zip
test:
needs: [release, release-compressed, release-executable, release-executable-compressed, debug, debug-compressed, check-phpunit]
runs-on: ubuntu-latest
container:
image: php:8.3
if: needs.check-phpunit.outputs.phpunit-exists == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: release
path: release
- name: Install dependencies
run: |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
curl -sSLf -o /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions
chmod +x /usr/local/bin/install-php-extensions
install-php-extensions zip
- name: Install phive
run: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
- name: Install phab
run: |
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Install latest version of NCC
run: |
git clone https://git.n64.cc/nosial/ncc.git
cd ncc
make redist
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
if [ -z "$NCC_DIR" ]; then
echo "NCC build directory not found"
exit 1
fi
php "$NCC_DIR/INSTALL" --auto
cd .. && rm -rf ncc
- name: Install NCC packages
run: |
ncc package install --package="release/net.nosial.tgbotlib.ncc" --build-source --reinstall -y --log-level debug
- name: Export token.txt
run: echo "${{ secrets.TELEGRAM_TEST_TOKEN }}" > tests/token.txt
- name: Run PHPUnit tests
run: |
wget https://phar.phpunit.de/phpunit-11.3.phar
php phpunit-11.3.phar --configuration phpunit.xml --log-junit reports/junit.xml --log-teamcity reports/teamcity --testdox-html reports/testdox.html --testdox-text reports/testdox.txt
- name: Upload test reports
uses: actions/upload-artifact@v4
with:
name: reports
path: reports
release-documentation:
needs: generate-phpdoc
permissions: write-all
runs-on: ubuntu-latest
container:
image: php:8.3
if: github.event_name == 'release'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download documentation artifact
uses: actions/download-artifact@v4
with:
name: documentation
path: documentation
- name: Upload documentation artifact
uses: softprops/action-gh-release@v1
with:
files: |
documentation/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-artifacts:
needs: [release, release-compressed, release-executable, release-executable-compressed, debug, debug-compressed]
permissions: write-all
runs-on: ubuntu-latest
container:
image: php:8.3
if: github.event_name == 'release'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download release artifact
uses: actions/download-artifact@v4
with:
name: release
path: release
- name: Upload release artifact to release
uses: softprops/action-gh-release@v1
with:
files: |
release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download release-compressed artifact
uses: actions/download-artifact@v4
with:
name: release-compressed
path: release-compressed
- name: Upload release-compressed artifact to release
uses: softprops/action-gh-release@v1
with:
files: |
release-compressed/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download release-executable artifact
uses: actions/download-artifact@v4
with:
name: release-executable
path: release-executable
- name: Upload release-executable artifact to release
uses: softprops/action-gh-release@v1
with:
files: |
release-executable/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download release-executable-compressed artifact
uses: actions/download-artifact@v4
with:
name: release-executable-compressed
path: release-executable-compressed
- name: Upload release-executable-compressed artifact to release
uses: softprops/action-gh-release@v1
with:
files: |
release-executable-compressed/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download debug artifact
uses: actions/download-artifact@v4
with:
name: debug
path: debug
- name: Upload debug artifact to release
uses: softprops/action-gh-release@v1
with:
files: |
debug/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download debug-compressed artifact
uses: actions/download-artifact@v4
with:
name: debug-compressed
path: debug-compressed
- name: Upload debug-compressed artifact to release
uses: softprops/action-gh-release@v1
with:
files: |
debug-compressed/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

8
.gitignore vendored
View file

@ -1 +1,7 @@
build/
build/
tests/token.txt
/.phpunit.result.cache
/.idea/php-test-framework.xml
/.idea/gbrowser_project.xml
/.phpdoc/
!/.github/workflows/ncc_workflow.yml

View file

@ -24,6 +24,7 @@ before_script:
- cd .. && rm -rf ncc
build:
stage: build
script:
- ncc build --config release --log-level debug
artifacts:
@ -36,6 +37,8 @@ release:
stage: deploy
script:
- ncc build --config release --log-level debug
- >
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/release/net.nosial.tgbotlib.ncc "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/net.nosial.tgbotlib/$CI_COMMIT_REF_NAME/net.nosial.tgbotlib.ncc"
artifacts:
paths:
- build/

View file

@ -1,6 +1,11 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="102" name="PHP" />
</Languages>
</inspection_tool>
<inspection_tool class="IncorrectHttpHeaderInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="customHeaders">
<set>
@ -19,6 +24,9 @@
<option value="X-Args-3" />
<option value="X-Args-4" />
<option value="X-Args-5" />
<option value="X-Temperature" />
<option value="X-Model" />
<option value="X-OPENAI-API-KEY" />
</set>
</option>
</inspection_tool>

15
.idea/php.xml generated
View file

@ -9,22 +9,25 @@
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PhpAnalysisConfiguration" call_tree_analysis_depth="3" />
<component name="PhpIncludePathManager">
<include_path>
<path value="/var/ncc/packages/net.nosial.optslib=1.1.2" />
<path value="/var/ncc/packages/net.nosial.loglib=2.0.2" />
<path value="/usr/share/php" />
<path value="/etc/ncc" />
<path value="/var/ncc/packages/net.nosial.tamerlib=1.0.0" />
<path value="/var/ncc/packages/net.nosial.loglib=1.0.1" />
<path value="/var/ncc/packages/net.nosial.tempfile=1.1.0" />
<path value="/var/ncc/packages/net.nosial.loglib=1.0.1" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<component name="PhpProjectSharedConfiguration" php_language_level="8.3">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PhpUnit">
<phpunit_settings>
<PhpUnitSettings load_method="PHPUNIT_PHAR" bootstrap_file_path="$PROJECT_DIR$/bootstrap.php" custom_loader_path="" phpunit_phar_path="$USER_HOME$/phpunit.phar" use_bootstrap_file="true" />
</phpunit_settings>
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>

10
.idea/runConfigurations/Build.xml generated Normal file
View file

@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" activateToolWindowBeforeRun="false">
<makefile filename="$PROJECT_DIR$/Makefile" target="build" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Clean" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
</method>
</configuration>
</component>

8
.idea/runConfigurations/Clean.xml generated Normal file
View file

@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Clean" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" activateToolWindowBeforeRun="false">
<makefile filename="$PROJECT_DIR$/Makefile" target="clean" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2" />
</configuration>
</component>

10
.idea/runConfigurations/Install.xml generated Normal file
View file

@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Install" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" activateToolWindowBeforeRun="false">
<makefile filename="$PROJECT_DIR$/Makefile" target="install" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Build" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
</method>
</configuration>
</component>

View file

@ -1,16 +1,176 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [8.0.2] - 2024-12-09
This update introduces some quality of life improvements.
### Added
* Added `containsMedia` method to `Message` object to check if the message contains media.
* Add support for handling callback query events
## [8.0.1] - 2024-12-04
This update introduces bug fixes and improvements
### Changed
* Refactor PollingBot to use PsyncLib for updates
* Refactor optional parameters in method signatures
* Improve command check with method existence validation
### Fixed
* Reposition debug log for event handler execution.
* Improve command check with method existence validation
* Allow nullable type for MessageEntity type
* Encode arrays as JSON in SendAudio parameters
* Refactor fromArray method for null data handling
## [8.0.0] - 2024-11-29
This is a new major update which makes the previous versions of this library deprecated
### Added
* Added unit tests
* Added `can_connect_to_business` & `has_main_web_app` to User object
### Changed
* Refactored the way HTTP requests are handled & methods are called
* Refactor enums to use native PHP 8.1 syntax
* Moved Types to their own namespace
* Refactored all Objects & Methods to use a different system
* Refactored the event system to allow for more event types
## [6.7.0] - 2023-08-10
This update accompanies the release of the [Telegram Bot API 6.7](https://core.telegram.org/bots/api#april-21-2023).
Additionally, this update includes some bug fixes and improvements such as the ability for some objects to be treated as
input objects for methods that require input objects.
### Added
* Added object `\TgBotLib\Objects\Telegram\InputMessageContent\InputTextMessageContent` to represent the content of a text message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram\InputMessageContent\InputLocationMessageContent` to represent the content of a location message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram\InputMessageContent\InputVenueMessageContent` to represent the content of a venue message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent` to represent the content of a contact message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram\InputMessageContent\InputInvoiceMessageContent` to represent the content of an invoice message to be sent as the result of an inline query.
* Added new exception class `NotImplementedException` to represent the case when a method is not implemented yet or the method is not applicable to the current object.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultArticle`, see [InlineQueryResultArticle](https://core.telegram.org/bots/api#inlinequeryresultarticle) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultPhoto`, see [InlineQueryResultPhoto](hthttps://git.n64.cc/nosial/libs/tgbot/-/issues/3https://git.n64.cc/nosial/libs/tgbot/-/issues/3tps://core.telegram.org/bots/api#inlinequeryresultphoto) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGif`, see [InlineQueryResultGif](https://core.telegram.org/bots/api#inlinequeryresultgif) for more information.
* Added abstract class `\TgBotLib\Abstracts\ThumbnailMimeType` to represent the mime type of thumbnail, photo, or a file / sticker thumbnail.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultMpeg4Gif`, see [InlineQueryResultMpeg4Gif](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif) for more information.
* Added field `via_chat_folder_invite_link` to `\TgBotLib\Objects\Telegram\ChatMemberUpdated` to represent the invite link, which was used by the user to join the chat; for joining by invite link events only.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVideo`, see [InlineQueryResultVideo](https://core.telegram.org/bots/api#inlinequeryresultvideo) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultAudio`, see [InlineQueryResultAudio](https://core.telegram.org/bots/api#inlinequeryresultaudio) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVoice`, see [InlineQueryResultVoice](https://core.telegram.org/bots/api#inlinequeryresultvoice) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultDocument`, see [InlineQueryResultDocument](https://core.telegram.org/bots/api#inlinequeryresultdocument) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultLocation`, see [InlineQueryResultLocation](https://core.telegram.org/bots/api#inlinequeryresultlocation) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVenue`, see [InlineQueryResultVenue](https://core.telegram.org/bots/api#inlinequeryresultvenue) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultContact`, see [InlineQueryResultContact](https://core.telegram.org/bots/api#inlinequeryresultcontact) for more information.
* Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGame`, see [InlineQueryResultGame](https://core.telegram.org/bots/api#inlinequeryresultgame) for more information.
* Added class `\TgBotLib\Objects\Telegram\InlineQueryResult` which is the base class for all inline query results, additionally added `\TgBotLib\Abstracts\InlineQueryResultType` to represent the type of inline query result object.
* Added method `\TgBotLib\Bot::answerWebAppQuery` to answer a callback query sent from a web app, which returns the newly added `\TgBotLib\Objects\Telegram\SentWebAppMessage` object on success.
* Implemented Telegram's currency API `\TgBotLib\Classes\Utilities::getCurrency` to get basic information about the currency of the specified country, see [Telegram's currency API](https://core.telegram.org/bots/payments) for more information.
### Changed
* Refactored InputMessageContent types to its own namespace so InputMessageContent can always return the correct InputMessageContent object type when calling `fromArray()`
* Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setUrl`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setText`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackData`,
`\TgBotLib\Objects\Telegram\InlineKeyboardButton::setWebApp`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setLoginUrl`,
`\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQuery`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQueryCurrentChat`,
`\TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackGame`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setPay`
to `\TgBotLib\Objects\Telegram\InlineKeyboardButton`
* Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow` & `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow` to `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup`
* Added method `\TgBotLib\Objects\Telegram\WebAppInfo::setUrl` to `\TgBotLib\Objects\Telegram\WebAppInfo`
* Added methods `\TgBotLib\Classes\Validate::url`, `\TgBotLib\Classes\Validate::length`, & `\TgBotLib\Classes\Validate::isHttps` to `\TgBotLib\Classes\Validate`
* Updated documentation for `\TgBotLib\Bot::editMessageMedia`
* Renamed namespace from `\TgBotLib\Abstracts` to `\TgBotLib\Enums`
* Updated class type to `final class` in `\TgBotLib\Enums > BotCommandScopeType`
* Updated class type to `final class` in `\TgBotLib\Enums > ChatActionType`
* Updated class type to `final class` in `\TgBotLib\Enums > ChatMemberStatus`
* Updated class type to `final class` in `\TgBotLib\Enums > ChatType`
* Updated class type to `final class` in `\TgBotLib\Enums > EventType`
* Updated class type to `final class` in `\TgBotLib\Enums > InlineQueryResultType`
* Updated class type to `final class` in `\TgBotLib\Enums > InputMediaType`
* Updated class type to `final class` in `\TgBotLib\Enums > InputButtonType`
* Updated class type to `final class` in `\TgBotLib\Enums > MessageEntityType`
* Updated class type to `final class` in `\TgBotLib\Enums > PassportElementType`
* Updated class type to `final class` in `\TgBotLib\Enums > PollType`
* Updated class type to `final class` in `\TgBotLib\Enums > StickerFormat`
* Updated class type to `final class` in `\TgBotLib\Enums > StickerType`
* Updated class type to `final class` in `\TgBotLib\Enums > ThumbnailMimeType`
* Updated class type to `final class` in `\TgBotLib\Enums > UpdateEventType`
* Updated method `\TgBotLib > Bot > handleGetUpdates()` to handle exceptions
* Updated README.md to reflect the new changes with TamerLib 2.+
### Fixed
* Fixed type in `\TgBotLib\Objects\Telegram > Message > fromArray()` where `forum_topic_created` is being parsed for
forum_topic_edited instead of `forum_topic_edited`
## [6.6.0] - 2023-04-10
This update accompanies the release of the [Telegram Bot API 6.6](https://core.telegram.org/bots/api#march-9-2023).
### Added
* Added the ability to set different bot descriptions for different user languages using the method `\TgBotLib\Bot\setMyDescription()`
see [setMyDescription](https://core.telegram.org/bots/api#setmydescription) for more information.
* Added the ability to get the current bot description in the given language as the class [BotDescription](https://core.telegram.org/bots/api#botdescription)
using the method `\TgBotLib\Bot\getMyDescription()` see [getMyDescription](https://core.telegram.org/bots/api#getmydescription) for more information.
* Added the ability to set different bot short descriptions for different user languages using the method `\TgBotLib\Bot\setMyShortDescription()`
see [setMyShortDescription](https://core.telegram.org/bots/api#setmyshortdescription) for more information.
* Added the ability to get the current bot short description in the given language as the class [BotShortDescription](https://core.telegram.org/bots/api#botshortdescription)
using the method `\TgBotLib\Bot\getMyShortDescription()` see [getMyShortDescription](https://core.telegram.org/bots/api#getmyshortdescription) for more information.
* Added method `\TgBotLib\Bot\sendSticker()` to send a sticker to a chat. See [sendSticker](https://core.telegram.org/bots/api#sendsticker) for more information.
* Added method `\TgBotLib\Bot\createNewStickerSet()` to create a new sticker set owned by a user. See [createNewStickerSet](https://core.telegram.org/bots/api#createnewstickerset) for more information.
* Added the field _needs_repainting_ to the [Sticker](https://core.telegram.org/bots/api#sticker) class
which can be obtained via `TgBotLib\Objects\Telegram\Sticker\needsRepainting()`
* Added method `\TgBotLib\Bot\addStickerToSet()` to add a new sticker to a set created by the bot.
See [addStickerToSet](https://core.telegram.org/bots/api#addstickertoset) for more information.
* Added abstract class `\TgBotLib\Abstracts\StickerFormat` to represent a sticker format ("`static`", "`animated`" or "`video`")
* Added method `\TgBotLib\Bot\uploadStickerFile()` to upload a sticker file with a sticker for later use in `createNewStickerSet` and `addStickerToSet` methods (can be used multiple times).
See [uploadStickerFile](https://core.telegram.org/bots/api#uploadstickerfile) for more information.
* Added method `\TgBotLib\Bot\setCustomEmojiStickerSetThumbnail()` to set the thumbnail of a sticker set.
See [setCustomEmojiStickerSetThumbnail](https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail) for more information.
* Added object `\TgBotLib\Objects\Telegram\StickerSet` to represent a sticker set.
* Added method `\TgBotLib\Bot\setStickerSetThumbnail()` to set the thumbnail of a sticker set.
See [setStickerSetThumbnail](https://core.telegram.org/bots/api#setstickersetthumbnail) for more information.
* Added method `\TgBotLib\Bot\setStickerSetTitle()` to set the title of a sticker set.
See [setStickerSetTitle](https://core.telegram.org/bots/api#setstickersettitle) for more information.
* Added method `\TgBotLib\Bot\deleteStickerSet()` to delete a sticker set.
See [deleteStickerSet](https://core.telegram.org/bots/api#deletestickerset) for more information.
* Added method `\TgBotLib\Bot\setStickerEmojiList()` to set the list of emojis for a sticker set.
See [setStickerEmojiList](https://core.telegram.org/bots/api#setstickeremojilist) for more information.
* Added method `\TgBotLib\Bot\setStickerKeywords()` to set the list of emojis for a sticker set.
See [setStickerKeywords](https://core.telegram.org/bots/api#setstickerkeywords) for more information.
* Added method `\TgBotLib\Bot\setStickerMaskPosition()` to change the mask position of a mask sticker.
See [setStickerMaskPosition](https://core.telegram.org/bots/api#setstickermaskposition) for more information.
### Changed
* Removed unused `__destruct()` method from `\TgBotLib\Bot`
* Added proper construction for `PollOption[]` objects in `TgBotLib\Objects\Telegram\Poll`
* Renamed `thumb` field in `TgBotLib\Objects\Telegram\Animation` to `thumbnail`
* Renamed `thumb` field in `TgBotLib\Objects\Telegram\Audio` to `thumbnail`
* Renamed `thumb` field in `TgBotLib\Objects\Telegram\Document` to `thumbnail`
* Renamed `thumb` field in `TgBotLib\Objects\Telegram\Sticker` to `thumbnail`
* Renamed `thumb` field in `TgBotLib\Objects\Telegram\Video` to `thumbnail`
* Renamed `thumb` field in `TgBotLib\Objects\Telegram\VideoNote` to `thumbnail`
### Fixed
* Fixed `TgBotLib\Objects\Telegram\Sticker\toArray()` to properly return the `premium_animation` field
## [6.5.2] - 2023-02-26
### Added
* Added dependency `net.nosial.tempfile` to create temporary files when uploading content from memory.
* Added `\TgBotLib\Abstracts > ChatActionType`
* Added logging events to `\TgBotLib\Bot > handleUpdate()`
* Added `\TgBotLib\Abstracts\ChatActionType`
* Added logging events to `\TgBotLib\Bot\handleUpdate()`
### Fixed
* Fixed file uploads when trying to upload content from memory.

View file

@ -1,8 +1,33 @@
# Variables
DEFAULT_CONFIGURATION ?= release
LOG_LEVEL = debug
# Default Target
all: release release-compressed release-executable release-executable-compressed debug debug-compressed
# Build Steps
release:
ncc build --config="release"
ncc build --config=release --log-level $(LOG_LEVEL)
release-compressed:
ncc build --config=release-compressed --log-level $(LOG_LEVEL)
release-executable:
ncc build --config=release-executable --log-level $(LOG_LEVEL)
release-executable-compressed:
ncc build --config=release-executable-compressed --log-level $(LOG_LEVEL)
debug:
ncc build --config=debug --log-level $(LOG_LEVEL)
debug-compressed:
ncc build --config=debug-compressed --log-level $(LOG_LEVEL)
install:
ncc package install --package="build/release/net.nosial.tgbotlib.ncc" --skip-dependencies --reinstall -y
uninstall:
ncc package uninstall -y --package="net.nosial.tgbotlib"
install: release
ncc package install --package=build/release/net.nosial.tgbotlib.ncc --skip-dependencies --build-source --reinstall -y --log-level $(LOG_LEVEL)
test: release
[ -f phpunit.xml ] || { echo "phpunit.xml not found"; exit 1; }
phpunit
clean:
rm -rf build
.PHONY: all install test clean release release-compressed release-executable release-executable-compressed debug debug-compressed

295
README.md
View file

@ -12,17 +12,7 @@ native around the API.
* [TgBotLib](#tgbotlib)
* [Table of contents](#table-of-contents)
* [Versioning](#versioning)
* [Installation](#installation)
* [Compile from source](#compile-from-source)
* [Requirements](#requirements)
* [Usage](#usage)
* [Documentation](#documentation)
* [Single-Threaded & Multi-Threaded Bots](#single-threaded--multi-threaded-bots)
* [Single-Threaded Bots](#single-threaded-bots)
* [Multi-Threaded Bots](#multi-threaded-bots)
* [Commands & Event Handlers](#commands--event-handlers)
* [Commands](#commands)
* [Event Handlers](#event-handlers)
* [TODO](#todo)
* [License](#license)
<!-- TOC -->
@ -36,288 +26,9 @@ version is `4`. Library patches are used to fix bugs or add improvements in the
Telegram Bot API version.
## Installation
## TODO
The library can be installed using ncc:
```bash
ncc install -p "nosial/libs.tgbot=latest@n64"
```
or by adding the following to your project.json file under the `build.dependencies` section:
```json
{
"name": "net.nosial.tgbotlib",
"version": "latest",
"source_type": "remote",
"source": "nosial/libs.tgbot=latest@n64"
}
```
If you don't have the n64 source configured, you can add it by running the following command:
```bash
ncc source add --name n64 --type gitlab --host git.n64.cc
```
## Compile from source
To compile the library from source, you need to have [ncc](https://git.n64.cc/nosial/ncc) installed, then run the
following command:
```bash
ncc build
```
## Requirements
The library requires PHP 8.0 or higher.
## Usage
1. Import the library using `import('net.nosial.tgbotlib');`
2. Create a new instance of the `TgBotLib\Bot` class, passing the bot token as the first argument
3. Profit
```php
require 'ncc';
import('net.nosial.tgbotlib');
$bot = new TgBotLib\Bot('<BOT TOKEN>');
/** @var \TgBotLib\Objects\Telegram\Update $update */
foreach ($bot->getUpdates() as $update)
{
$bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello World!');
}
```
Each method of the `TgBotLib\Bot` class is named after the corresponding method of the Telegram Bot API, all methods
contains an optional `$parameters` argument that can be used to pass additional parameters to the API method.
But for methods that has required parameters, the library provides a more convenient way to pass them, by using
named parameters. For example, the `sendMessage` method requires the `chat_id` and `text` parameters, but instead
of passing them as an array, you can pass them as named parameters:
```php
$bot->sendMessage(
chat_id: '<CHAT ID>',
text: 'Hello World!',
options: [
'parse_mode' => 'Markdown',
'disable_web_page_preview' => true,
]
);
```
## Documentation
Almost everything in the library has PhpDoc documentation, so you can use your IDE to get documentation for the
library. For example, in PhpStorm, you can press `Ctrl+Q` on a method to get the documentation for it:
![PhpStorm Documentation](assets/documentation.png)
## Single-Threaded & Multi-Threaded Bots
This part will explain how to implement single-threaded and multi-threaded bots using the library.
For more examples see the [tests](tests) directory.
### Single-Threaded Bots
To implement a single-threaded bot, it's very self-explanatory, you just need to create a new instance of the
`TgBotLib\Bot` class and use it to handle the updates:
```php
<?php
// Import ncc
require 'ncc';
import('net.nosial.tgbotlib');
// Require commands & event handlers
require 'commands' . DIRECTORY_SEPARATOR . 'StartCommand.php';
require 'commands' . DIRECTORY_SEPARATOR . 'HashCommand.php';
// Create a new instance of the bot
$bot = new TgBotLib\Bot(getenv('BOT_TOKEN'));
// Loop forever
while(true)
{
/** @var \TgBotLib\Objects\Telegram\Update $update */
foreach ($bot->getUpdates() as $update)
{
$bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello World!');
}
}
```
This approach is very simple and allows for easier debugging, but it's not recommended for production use, because
it will block the script until the updates are handled, and if the bot receives a lot of updates, it will take a
long time to handle them. So it's recommended to use a multithreaded approach for production bots.
### Multi-Threaded Bots
To implement a multi-threaded bot, you need to install [TamerLib](https://git.n64.cc/nosial/libs/tamer) which will allow
you to run parallel operations using a Message Server
First create a worker process that will handle the updates:
```php
<?php
// Import ncc
require 'ncc';
// Import packages
import('net.nosial.tgbotlib');
import('net.nosial.tamerlib');
// Require commands
require 'commands' . DIRECTORY_SEPARATOR . 'StartCommand.php';
require 'commands' . DIRECTORY_SEPARATOR . 'HashCommand.php';
// Initialize the bot
$bot = new TgBotLib\Bot('bot_token');
// Set the command handlers
$bot->setCommandHandler('start', new \commands\StartCommand());
$bot->setCommandHandler('hash', new \commands\HashCommand());
// Initialize the worker & register the handle_update function
TamerLib\Tamer::initWorker();
TamerLib\Tamer::addFunction('handle_update', function (\TamerLib\Objects\Job $job) use ($bot)
{
$bot->handleUpdate(\TgBotLib\Objects\Telegram\Update::fromArray(json_decode($job->getData(), true)));
});
// Work forever
TamerLib\Tamer::work();
```
Then create a master process that will send the updates to the worker:
```php
<?php
// Import ncc
require 'ncc';
// Import packages
import('net.nosial.tgbotlib');
import('net.nosial.tamerlib');
// Require commands
require 'commands' . DIRECTORY_SEPARATOR . 'StartCommand.php';
require 'commands' . DIRECTORY_SEPARATOR . 'HashCommand.php';
// Initialize the bot
$bot = new TgBotLib\Bot('bot_token');
// Initialize the master & add the worker
TamerLib\Tamer::init(\TamerLib\Abstracts\ProtocolType::Gearman, [
'127.0.0.1:4730'
]);
TamerLib\Tamer::addWorker('handle_update', 4);
// Start the workers
TamerLib\Tamer::startWorkers();
// Handle updates forever
while(true)
{
/** @var \TgBotLib\Objects\Telegram\Update $update */
foreach ($bot->getUpdates() as $update)
{
TamerLib\Tamer::do('handle_update', json_encode($update->toArray()));
}
}
```
## Commands & Event Handlers
Commands and event handlers are a way to handle commands and events sent by the user, for example, when the user
sends the `/start` command, you can send a welcome message to the user.
### Commands
The library provides a way to handle commands and events using the `TgBotLib\Bot` class, for example, to handle
the `/start` command, you can use the `setCommandHandler` method:
```php
<?php
require 'ncc';
import('net.nosial.tgbotlib');
$bot = new TgBotLib\Bot(getenv('BOT_TOKEN'));
$bot->setCommandHandler('start', new \commands\StartCommand());
```
The `setCommandHandler` method takes two arguments, the first being the command name (without the `/` prefix), and
the second being a class that implements the `TgBotLib\Interfaces\CommandInterface` interface.
The interface has only one method, `handle`, which takes two arguments, the first being an instance of the
`TgBotLib\Bot` class which is used to invoke the API without having to recreate the instance, and the second being
the update object. The update object is an instance of the `TgBotLib\Objects\Telegram\Update` class, which contains
all the information about the update.
```php
<?php
namespace commands;
use TgBotLib\Bot;
use TgBotLib\Interfaces\CommandInterface;
use TgBotLib\Objects\Telegram\Update;
class StartCommand extends CommandInterface
{
public function handle(Bot $bot, Update $update): void
{
$bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello World!');
}
}
```
### Event Handlers
Event handles are similarly implemented, but instead of using the `setCommandHandler` method, you use the
`setEventHandler` method:
```php
<?php
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
$bot = new TgBotLib\Bot(getenv('BOT_TOKEN'));
$bot->setEventHandler('message', new \events\MessageEvent());
```
And the interface EventInterface is used instead of CommandInterface:
```php
<?php
namespace events;
use TgBotLib\Bot;
use TgBotLib\Interfaces\EventInterface;
use TgBotLib\Objects\Telegram\Update;
class MessageEvent implements EventInterface
{
public function handle(Bot $bot, Update $update): void
{
$bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello World!');
}
}
```
Documentation will be redone
# License

14
bootstrap.php Normal file
View file

@ -0,0 +1,14 @@
<?php
require 'ncc';
$token_path = __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'token.txt';
if(!file_exists($token_path))
{
throw new Exception(sprintf('The token file "%s" does not exist.', $token_path));
}
define('BOT_TOKEN', trim(file_get_contents($token_path)));
const TEST_CHAT_ID = -1001301191379;
import('net.nosial.tgbotlib');

15
phpdoc.dist.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdocumentor configVersion="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpdoc.org" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd">
<paths>
<output>build/docs</output>
<cache>build/cache</cache>
</paths>
<version number="latest">
<api>
<source dsn=".">
<path>src/TgBotLib</path>
</source>
<default-package-name>TgBotLib</default-package-name>
</api>
</version>
</phpdocumentor>

11
phpunit.xml Normal file
View file

@ -0,0 +1,11 @@
<phpunit bootstrap="bootstrap.php">
<testsuites>
<testsuite name="TgBotLib Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_DIR" value="app/"/>
</php>
</phpunit>

View file

@ -12,7 +12,7 @@
"package": "net.nosial.tgbotlib",
"description": "TgBotLib is a library for interacting with the Telegram Bot API",
"company": "Nosial",
"version": "6.5.2",
"version": "8.0.2",
"uuid": "b409e036-ab04-11ed-b32e-9d3f57a644ae"
},
"build": {
@ -30,13 +30,69 @@
"version": "latest",
"source_type": "remote",
"source": "nosial/libs.tempfile=latest@n64"
},
{
"name": "net.nosial.optslib",
"version": "latest",
"source_type": "remote",
"source": "nosial/libs.opts=latest@n64"
},
{
"name": "net.nosial.psynclib",
"version": "latest",
"source_type": "remote",
"source": "nosial/libs.psync=latest@n64"
}
],
"configurations": [
{
"name": "release",
"output_path": "build/release"
"build_type": "ncc",
"output": "build/release/%ASSEMBLY.PACKAGE%.ncc"
},
{
"name": "release-compressed",
"build_type": "ncc",
"output": "build/release/%ASSEMBLY.PACKAGE%.gz.ncc",
"options": {
"compression": "high"
}
},
{
"name": "release-executable",
"build_type": "executable",
"output": "build/release/%ASSEMBLY.NAME%",
"options": {
"ncc_configuration": "release"
}
},
{
"name": "release-executable-compressed",
"build_type": "executable",
"output": "build/release/%ASSEMBLY.NAME%_gz",
"options": {
"ncc_configuration": "release-compressed"
}
},
{
"name": "debug",
"build_type": "ncc",
"output": "build/debug/%ASSEMBLY.PACKAGE%.ncc",
"define_constants": {
"DEBUG": "1"
}
},
{
"name": "debug-compressed",
"build_type": "ncc",
"output": "build/debug/%ASSEMBLY.PACKAGE%.gz.ncc",
"define_constants": {
"DEBUG": "1"
},
"options": {
"compression": "high"
}
}
]
}
}
}

View file

@ -1,14 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class BotCommandScopeType
{
const Default = 'default';
const AllPrivateChats = 'all_private_chats';
const AllGroupChats = 'all_group_chats';
const AllChatAdministrators = 'all_chat_administrators';
const Chat = 'chat';
const ChatAdministrators = 'chat_administrators';
const ChatMember = 'chat_member';
}

View file

@ -1,17 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class ChatActionType
{
const Typing = 'typing';
const UploadPhoto = 'upload_photo';
const RecordVideo = 'record_video';
const UploadVideo = 'upload_video';
const RecordAudio = 'record_audio';
const UploadAudio = 'upload_audio';
const UploadDocument = 'upload_document';
const FindLocation = 'find_location';
const RecordVideoNote = 'record_video_note';
const UploadVideoNote = 'upload_video_note';
}

View file

@ -1,13 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class ChatMemberStatus
{
const Creator = 'creator';
const Administrator = 'administrator';
const Member = 'member';
const Restricted = 'restricted';
const Left = 'left';
const Kicked = 'kicked';
}

View file

@ -1,11 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class ChatType
{
const Private = 'private';
const Group = 'group';
const Supergroup = 'supergroup';
const Channel = 'channel';
}

View file

@ -1,43 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class EventType
{
const GenericUpdate = 'generic_update';
const Message = 'message';
const EditedMessage = 'edited_message';
const GenericCommandMessage = 'generic_command_message';
const ChatMemberJoined = 'chat_member_joined';
const ChatMemberLeft = 'chat_member_left';
const ChatMemberKicked = 'chat_member_kicked';
const ChatMemberBanned = 'chat_member_banned';
const ChatMemberUnbanned = 'chat_member_unbanned';
const ChatMemberPromoted = 'chat_member_promoted';
const ChatMemberDemoted = 'chat_member_demoted';
const ChatMemberRestricted = 'chat_member_restricted';
const ChatMemberUnrestricted = 'chat_member_unrestricted';
const ChatTitleChanged = 'chat_title_changed';
const ChatPhotoChanged = 'chat_photo_changed';
Const CallbackQuery = 'callback_query';
const All = [
self::GenericUpdate,
self::Message,
self::EditedMessage,
self::GenericCommandMessage,
self::ChatMemberJoined,
self::ChatMemberLeft,
self::ChatMemberKicked,
self::ChatMemberBanned,
self::ChatMemberUnbanned,
self::ChatMemberPromoted,
self::ChatMemberDemoted,
self::ChatMemberRestricted,
self::ChatMemberUnrestricted,
self::ChatTitleChanged,
self::ChatPhotoChanged,
self::CallbackQuery,
];
}

View file

@ -1,12 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class InputMediaType
{
const Photo = 'photo';
const Video = 'video';
const Animation = 'animation';
const Audio = 'audio';
const Document = 'document';
}

View file

@ -1,11 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class MenuButtonType
{
const Commands = 'commands';
const WebApp = 'web_app';
const Default = 'default';
}

View file

@ -1,41 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class MessageEntityType
{
const Mention = 'mention';
const Hashtag = 'hashtag';
const CashTag = 'cashtag';
const BotCommand = 'bot_command';
const Url = 'url';
const Email = 'email';
const PhoneNumber = 'phone_number';
const Bold = 'bold';
const Italic = 'italic';
const Underline = 'underline';
const Strikethrough = 'strikethrough';
const Spoiler = 'spoiler';
const Code = 'code';
const Pre = 'pre';
const TextLink = 'text_link';
const TextMention = 'text_mention';
const CustomEmoji = 'custom_emoji';
}

View file

@ -0,0 +1,153 @@
<?php
namespace TgBotLib\Abstracts;
use CURLFile;
use CurlHandle;
use InvalidArgumentException;
use TgBotLib\Bot;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Interfaces\ObjectTypeInterface;
abstract class Method
{
/**
* Executes a bot command with the given parameters.
*
* @param Bot $bot The bot instance on which the command is to be executed.
* @param array $parameters The parameters required for the bot command.
* @return ObjectTypeInterface|ObjectTypeInterface[]|mixed The result of the bot command.
* @throws TelegramException if the response from the bot command is not valid.
* @throws InvalidArgumentException if the required parameters are not provided.
*/
public abstract static function execute(Bot $bot, array $parameters=[]): mixed;
/**
* Retrieves a list of required parameters for a specific operation.
*
* @return array|null An array of required parameters.
*/
public abstract static function getRequiredParameters(): ?array;
/**
* Retrieves the optional parameters for a request.
*
* @return array|null An array of optional parameters.
*/
public abstract static function getOptionalParameters(): ?array;
/**
* Builds a cURL handle for making a POST request to a bot's endpoint.
*
* @param Bot $bot The bot object containing the endpoint information.
* @param string $method
* @param array|null $parameters An array of parameters to be sent in the POST request.
* @return CurlHandle The configured cURL handle ready for execution.
*/
protected static function buildPost(Bot $bot, string $method, ?array $parameters = null): CurlHandle {
$curl = curl_init(sprintf('%s/bot%s/%s', $bot->getEndpoint(), $bot->getToken(), $method));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
if ($parameters === null)
{
curl_setopt($curl, CURLOPT_POST, false);
}
else
{
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters));
}
return $curl;
}
/**
* Builds a cURL handle for uploading a file to the Telegram API.
*
* @param Bot $bot The bot instance used to get the endpoint.
* @param string $file_param The parameter name for the file to be uploaded.
* @param string $file_path The file path of the file to be uploaded.
* @param array $parameters Additional parameters to be included in the request.
* @return CurlHandle The cURL handle configured for the file upload.
*/
protected static function buildUpload(Bot $bot, string $method, string $file_param, string $file_path, array $parameters): CurlHandle
{
$curl = curl_init(sprintf('%s/bot%s/%s', $bot->getEndpoint(), $bot->getToken(), $method));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: multipart/form-data']);
// Merge file with other parameters
$parameters[$file_param] = new CURLFile($file_path);
curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);
return $curl;
}
/**
* Builds a cURL handle for a multi-part file upload request to a bot API.
*
* @param Bot $bot The bot instance to configure the request for.
* @param string $method The API method to call.
* @param array $files An associative array of parameter names and file paths to upload.
* @param array $parameters An associative array of additional parameters for the request.
* @return CurlHandle The configured cURL handle.
*/
protected static function buildMultiUpload(Bot $bot, string $method, array $files, array $parameters): CurlHandle
{
$curl = curl_init(sprintf('%s/bot%s/%s', $bot->getEndpoint(), $bot->getToken(), $method));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: multipart/form-data']);
$postFields = [];
foreach ($files as $param => $file)
{
$postFields[$param] = new CURLFile($file);
}
foreach ($parameters as $key => $value)
{
$postFields[$key] = $value;
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
return $curl;
}
/**
* Executes a cURL request and processes the response.
*
* @param CurlHandle $curl The cURL handle to be executed.
* @return array The decoded response from the cURL request.
* @throws TelegramException if the response is not a valid array,
* or if the 'ok' field is not set or is false.
*/
protected static function executeCurl(CurlHandle $curl): mixed
{
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
if(!is_array($result))
{
throw new TelegramException('Invalid response from Telegram API');
}
if(!isset($result['ok']))
{
throw new TelegramException('Invalid response from Telegram API');
}
if($result['ok'] === false)
{
throw new TelegramException($result['description'], (int)$result['error_code']);
}
return $result['result'];
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class PassportElementType
{
const PersonalDetails = 'personal_details';
const Passport = 'passport';
const DriverLicense = 'driver_license';
const IdentityCard = 'identity_card';
const InternalPassport = 'internal_passport';
const Address = 'address';
const UtilityBill = 'utility_bill';
const BankStatement = 'bank_statement';
const RentalAgreement = 'rental_agreement';
const PassportRegistration = 'passport_registration';
const TemporaryRegistration = 'temporary_registration';
const PhoneNumber = 'phone_number';
const Email = 'email';
}

View file

@ -1,10 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class PollType
{
const Regular = 'regular';
const Quiz = 'quiz';
}

View file

@ -1,12 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class StickerType
{
const Regular = 'regular';
const Mask = 'mask';
const CustomEmoji = 'custom_emoji';
}

View file

@ -1,12 +0,0 @@
<?php
namespace TgBotLib\Abstracts;
abstract class UpdateEventType
{
const GenericUpdate = 'generic_update';
const Message = 'message';
const EditedMessage = 'edited_message';
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Classes;
use LogLib\Log;
class Logger
{
private static ?\LogLib\Logger $logger = null;
/**
* Retrieves the instance of the logger. If the logger instance does not
* exist, it initializes a new logger for the application and registers
* the exception handler.
*
* @return \LogLib\Logger The logger instance.
*/
public static function getLogger(): \LogLib\Logger
{
if(self::$logger === null)
{
self::$logger = new \LogLib\Logger('net.nosial.tgbotlib');
Log::registerExceptionHandler();
}
return self::$logger;
}
}

View file

@ -1,8 +1,53 @@
<?php
namespace TgBotLib\Classes;
use Exception;
use LogLib\Log;
use TgBotLib\Objects\Currency;
class Utilities
{
/**
* @var Currency[]|null
*/
private static ?array $currencies_cache = null;
/**
* Retrieves the currency object associated with the given currency code.
*
* @param string $code The currency code to look up.
* @return Currency The currency object corresponding to the given code.
* @throws Exception If the currency code is not found or fetching currencies fails.
* @deprecated Not used
*/
public static function getCurrency(string $code): Currency
{
if (self::$currencies_cache === null)
{
$source = "https://core.telegram.org/bots/payments/currencies.json";
Log::verbose('net.nosial.tgbotlib', "Fetching currencies from $source");
$data = json_decode(file_get_contents($source), true);
if ($data === null)
throw new Exception("Failed to fetch currencies");
self::$currencies_cache = [];
foreach ($data as $currency)
{
self::$currencies_cache[strtolower($currency['code'])] = Currency::fromArray($currency);
}
Log::verbose('net.nosial.tgbotlib', "Fetched " . count(self::$currencies_cache) . " supported currencies");
}
if(!isset(self::$currencies_cache[strtolower($code)]))
{
throw new Exception("Currency $code not found");
}
return self::$currencies_cache[strtolower($code)];
}
}

View file

@ -4,5 +4,39 @@
class Validate
{
/**
* Validates if a URL is valid or not
*
* @param string $url
* @return bool
*/
public static function url(string $url): bool
{
return filter_var($url, FILTER_VALIDATE_URL) !== false;
}
/**
* Returns true if the given input is within the specified length range
*
* @param string $input
* @param int $min_length
* @param int $max_length
* @return bool
*/
public static function length(string $input, int $min_length, int $max_length): bool
{
$length = strlen($input);
return $length >= $min_length && $length <= $max_length;
}
/**
* Determines if the given URL is an HTTPS URL
*
* @param string $url
* @return bool
*/
public static function isHttps(string $url): bool
{
return strpos($url, 'https://') === 0;
}
}

View file

@ -0,0 +1,180 @@
<?php
namespace TgBotLib\Enums;
use TgBotLib\Events\BusinessConnectionEvent;
use TgBotLib\Events\BusinessMessageEvent;
use TgBotLib\Events\CallbackQueryEvent;
use TgBotLib\Events\ChannelPostEvent;
use TgBotLib\Events\ChatBoostEvent;
use TgBotLib\Events\ChatJoinRequestEvent;
use TgBotLib\Events\ChatMemberUpdatedEvent;
use TgBotLib\Events\ChosenInlineResultEvent;
use TgBotLib\Events\CommandEvent;
use TgBotLib\Events\DeletedBusinessMessagesEvent;
use TgBotLib\Events\EditedBusinessMessageEvent;
use TgBotLib\Events\EditedChannelPostEvent;
use TgBotLib\Events\EditedMessageEvent;
use TgBotLib\Events\InlineQueryEvent;
use TgBotLib\Events\MessageEvent;
use TgBotLib\Events\MessageReactionCountEvent;
use TgBotLib\Events\MessageReactionEvent;
use TgBotLib\Events\MyChatMemberUpdatedEvent;
use TgBotLib\Events\PaidMediaPurchasedEvent;
use TgBotLib\Events\PollAnswerEvent;
use TgBotLib\Events\PollEvent;
use TgBotLib\Events\PreCheckoutQueryEvent;
use TgBotLib\Events\RemovedChatBoostEvent;
use TgBotLib\Events\ShippingQueryEvent;
use TgBotLib\Events\UpdateEvent;
use TgBotLib\Objects\Update;
enum EventType : string
{
case UPDATE_EVENT = UpdateEvent::class;
case REMOVED_CHAT_BOOST_EVENT = RemovedChatBoostEvent::class;
case CHAT_BOOST_EVENT = ChatBoostEvent::class;
case CHAT_JOIN_REQUEST_EVENT = ChatJoinRequestEvent::class;
case CHAT_MEMBER_UPDATED = ChatMemberUpdatedEvent::class;
case MY_CHAT_MEMBER_UPDATED = MyChatMemberUpdatedEvent::class;
case POLL_ANSWER = PollAnswerEvent::class;
case POLL = PollEvent::class;
case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class;
case PRE_CHECKOUT_QUERY = PreCheckoutQueryEvent::class;
case SHIPPING_QUERY = ShippingQueryEvent::class;
case CALLBACK_QUERY = CallbackQueryEvent::class;
case CHOSEN_INLINE_RESULT = ChosenInlineResultEvent::class;
case INLINE_QUERY = InlineQueryEvent::class;
case MESSAGE_REACTION_COUNT = MessageReactionCountEvent::class;
case MESSAGE_REACTION = MessageReactionEvent::class;
case DELETED_BUSINESS_MESSAGES = DeletedBusinessMessagesEvent::class;
case EDITED_BUSINESS_MESSAGE = EditedBusinessMessageEvent::class;
case BUSINESS_MESSAGE = BusinessMessageEvent::class;
case BUSINESS_CONNECTION = BusinessConnectionEvent::class;
case EDITED_CHANNEL_POST = EditedChannelPostEvent::class;
case CHANNEL_POST = ChannelPostEvent::class;
case EDITED_MESSAGE = EditedMessageEvent::class;
case MESSAGE = MessageEvent::class;
case COMMAND = CommandEvent::class;
/**
* Determines the type of event based on the provided Update object.
*
* @param Update $update The update object containing event details.
* @return EventType The type of event detected from the update.
*/
public static function determineEventType(Update $update): EventType
{
if($update->getRemovedChatBoost() !== null)
{
return EventType::REMOVED_CHAT_BOOST_EVENT;
}
if($update->getChatBoost() !== null)
{
return EventType::CHAT_BOOST_EVENT;
}
if($update->getChatJoinRequest() !== null)
{
return EventType::CHAT_JOIN_REQUEST_EVENT;
}
if($update->getChatMember() !== null)
{
return EventType::CHAT_MEMBER_UPDATED;
}
if($update->getMyChatMember() !== null)
{
return EventType::MY_CHAT_MEMBER_UPDATED;
}
if($update->getPollAnswer() !== null)
{
return EventType::POLL_ANSWER;
}
if($update->getPoll() !== null)
{
return EventType::POLL;
}
if($update->getPurchasedPaidMedia() !== null)
{
return EventType::PAID_MEDIA_PURCHASED;
}
if($update->getPreCheckoutQuery() !== null)
{
return EventType::PRE_CHECKOUT_QUERY;
}
if($update->getShippingQuery() !== null)
{
return EventType::SHIPPING_QUERY;
}
if($update->getChosenInlineResult() !== null)
{
return EventType::CHOSEN_INLINE_RESULT;
}
if($update->getInlineQuery() !== null)
{
return EventType::INLINE_QUERY;
}
if($update->getMessageReactionCount() !== null)
{
return EventType::MESSAGE_REACTION_COUNT;
}
if($update->getMessageReaction() !== null)
{
return EventType::MESSAGE_REACTION;
}
if($update->getDeletedBusinessMessages() !== null)
{
return EventType::DELETED_BUSINESS_MESSAGES;
}
if($update->getEditedBusinessMessage() !== null)
{
return EventType::EDITED_BUSINESS_MESSAGE;
}
if($update->getBusinessMessage() !== null)
{
return EventType::BUSINESS_MESSAGE;
}
if($update->getBusinessConnection() !== null)
{
return EventType::BUSINESS_CONNECTION;
}
if($update->getEditedChannelPost() !== null)
{
return EventType::EDITED_CHANNEL_POST;
}
if($update->getChannelPost() !== null)
{
return EventType::CHANNEL_POST;
}
if($update->getEditedMessage() !== null)
{
return EventType::EDITED_MESSAGE;
}
if($update->getMessage() !== null)
{
return EventType::MESSAGE;
}
return EventType::UPDATE_EVENT;
}
}

View file

@ -0,0 +1,407 @@
<?php
namespace TgBotLib\Enums;
use TgBotLib\Bot;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Interfaces\ObjectTypeInterface;
use TgBotLib\Methods\AddStickerToSet;
use TgBotLib\Methods\AnswerCallbackQuery;
use TgBotLib\Methods\AnswerInlineQuery;
use TgBotLib\Methods\AnswerPreCheckoutQuery;
use TgBotLib\Methods\AnswerShippingQuery;
use TgBotLib\Methods\AnswerWebAppQuery;
use TgBotLib\Methods\ApproveChatJoinRequest;
use TgBotLib\Methods\BanChatMember;
use TgBotLib\Methods\BanChatSenderChat;
use TgBotLib\Methods\Close;
use TgBotLib\Methods\CloseForumTopic;
use TgBotLib\Methods\CloseGeneralForumTopic;
use TgBotLib\Methods\CopyMessage;
use TgBotLib\Methods\CopyMessages;
use TgBotLib\Methods\CreateChatInviteLink;
use TgBotLib\Methods\CreateChatSubscriptionInviteLink;
use TgBotLib\Methods\CreateForumTopic;
use TgBotLib\Methods\CreateInvoiceLink;
use TgBotLib\Methods\CreateNewStickerSet;
use TgBotLib\Methods\DeclineChatJoinRequest;
use TgBotLib\Methods\DeleteChatPhoto;
use TgBotLib\Methods\DeleteChatStickerSet;
use TgBotLib\Methods\DeleteForumTopic;
use TgBotLib\Methods\DeleteMessage;
use TgBotLib\Methods\DeleteMessages;
use TgBotLib\Methods\DeleteMyCommands;
use TgBotLib\Methods\DeleteStickerFromSet;
use TgBotLib\Methods\DeleteStickerSet;
use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\EditChatInviteLink;
use TgBotLib\Methods\EditChatSubscriptionInviteLink;
use TgBotLib\Methods\EditForumTopic;
use TgBotLib\Methods\EditGeneralForumTopic;
use TgBotLib\Methods\EditMessageCaption;
use TgBotLib\Methods\EditMessageLiveLocation;
use TgBotLib\Methods\EditMessageMedia;
use TgBotLib\Methods\EditMessageReplyMarkup;
use TgBotLib\Methods\EditMessageText;
use TgBotLib\Methods\ExportChatInviteLink;
use TgBotLib\Methods\ForwardMessage;
use TgBotLib\Methods\ForwardMessages;
use TgBotLib\Methods\GetAvailableGifts;
use TgBotLib\Methods\GetBusinessConnection;
use TgBotLib\Methods\GetChat;
use TgBotLib\Methods\GetChatAdministrators;
use TgBotLib\Methods\GetChatMember;
use TgBotLib\Methods\GetChatMemberCount;
use TgBotLib\Methods\GetChatMenuButton;
use TgBotLib\Methods\GetCustomEmojiStickers;
use TgBotLib\Methods\GetFile;
use TgBotLib\Methods\GetForumTopicIconStickers;
use TgBotLib\Methods\GetGameHighScores;
use TgBotLib\Methods\GetMe;
use TgBotLib\Methods\GetMyCommands;
use TgBotLib\Methods\GetMyDefaultAdministratorRights;
use TgBotLib\Methods\GetMyDescription;
use TgBotLib\Methods\GetMyName;
use TgBotLib\Methods\GetMyShortDescription;
use TgBotLib\Methods\GetStarTransactions;
use TgBotLib\Methods\GetStickerSet;
use TgBotLib\Methods\GetUpdates;
use TgBotLib\Methods\GetUserChatBoosts;
use TgBotLib\Methods\GetUserProfilePhotos;
use TgBotLib\Methods\GetWebhookInfo;
use TgBotLib\Methods\HideGeneralForumTopic;
use TgBotLib\Methods\LeaveChat;
use TgBotLib\Methods\Logout;
use TgBotLib\Methods\PinChatMessage;
use TgBotLib\Methods\PromoteChatMember;
use TgBotLib\Methods\ReopenForumTopic;
use TgBotLib\Methods\ReopenGeneralForumTopic;
use TgBotLib\Methods\ReplaceStickerInSet;
use TgBotLib\Methods\RestrictChatMember;
use TgBotLib\Methods\RevokeChatInviteLink;
use TgBotLib\Methods\SavePreparedInlineMessage;
use TgBotLib\Methods\SendAnimation;
use TgBotLib\Methods\SendAudio;
use TgBotLib\Methods\SendChatAction;
use TgBotLib\Methods\SendContact;
use TgBotLib\Methods\SendDice;
use TgBotLib\Methods\SendDocument;
use TgBotLib\Methods\SendGame;
use TgBotLib\Methods\SendGift;
use TgBotLib\Methods\SendInvoice;
use TgBotLib\Methods\SendLocation;
use TgBotLib\Methods\SendMediaGroup;
use TgBotLib\Methods\SendMessage;
use TgBotLib\Methods\SendPaidMedia;
use TgBotLib\Methods\SendPhoto;
use TgBotLib\Methods\SendPoll;
use TgBotLib\Methods\SendSticker;
use TgBotLib\Methods\SendVenue;
use TgBotLib\Methods\SendVideo;
use TgBotLib\Methods\SendVideoNote;
use TgBotLib\Methods\SendVoice;
use TgBotLib\Methods\SetChatAdministratorCustomTitle;
use TgBotLib\Methods\SetChatDescription;
use TgBotLib\Methods\SetChatMenuButton;
use TgBotLib\Methods\SetChatPermissions;
use TgBotLib\Methods\SetChatPhoto;
use TgBotLib\Methods\SetChatStickerSet;
use TgBotLib\Methods\SetChatTitle;
use TgBotLib\Methods\SetCustomEmojiStickerSetThumbnail;
use TgBotLib\Methods\SetGameScore;
use TgBotLib\Methods\SetMessageReaction;
use TgBotLib\Methods\SetMyCommands;
use TgBotLib\Methods\SetMyDefaultAdministratorRights;
use TgBotLib\Methods\SetMyDescription;
use TgBotLib\Methods\SetMyName;
use TgBotLib\Methods\SetMyShortDescription;
use TgBotLib\Methods\SetPassportDataErrors;
use TgBotLib\Methods\SetStickerEmojiList;
use TgBotLib\Methods\SetStickerMaskPosition;
use TgBotLib\Methods\SetStickerPositionInSet;
use TgBotLib\Methods\SetStickerSetThumbnail;
use TgBotLib\Methods\SetStickerSetTitle;
use TgBotLib\Methods\SetWebhook;
use TgBotLib\Methods\StopMessageLiveLocation;
use TgBotLib\Methods\StopPoll;
use TgBotLib\Methods\UnbanChatMember;
use TgBotLib\Methods\UnbanChatSenderChat;
use TgBotLib\Methods\UnhideGeneralForumTopic;
use TgBotLib\Methods\UnpinAllChatMessages;
use TgBotLib\Methods\UnpinAllForumTopicMessages;
use TgBotLib\Methods\UnpinAllGeneralForumTopicMessages;
use TgBotLib\Methods\UnpinChatMessage;
use TgBotLib\Methods\UploadStickerFile;
enum Methods : string
{
case GET_UPDATES = 'getUpdates';
case SET_WEBHOOK = 'setWebhook';
case DELETE_WEBHOOK = 'deleteWebhook';
case GET_WEBHOOK_INFO = 'getWebhookInfo';
case GET_ME = 'getMe';
case LOGOUT = 'logOut';
case CLOSE = 'close';
case SEND_MESSAGE = 'sendMessage';
case FORWARD_MESSAGE = 'forwardMessage';
case FORWARD_MESSAGES = 'forwardMessages';
case COPY_MESSAGE = 'copyMessage';
case COPY_MESSAGES = 'copyMessages';
case SEND_PHOTO = 'sendPhoto';
case SEND_AUDIO = 'sendAudio';
case SEND_DOCUMENT = 'sendDocument';
case SEND_VIDEO = 'sendVideo';
case SEND_ANIMATION = 'sendAnimation';
case SEND_VOICE = 'sendVoice';
case SEND_VIDEO_NOTE = 'sendVideoNote';
case SEND_PAID_MEDIA = 'sendPaidMedia';
case SEND_MEDIA_GROUP = 'sendMediaGroup';
case SEND_LOCATION = 'sendLocation';
case SEND_VENUE = 'sendVenue';
case SEND_CONTACT = 'sendContact';
case SEND_POLL = 'sendPoll';
case SEND_DICE = 'sendDice';
case SEND_CHAT_ACTION = 'sendChatAction';
case SET_MESSAGE_REACTION = 'setMessageReaction';
case GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos';
case GET_FILE = 'getFile';
case BAN_CHAT_MEMBER = 'banChatMember';
case UNBAN_CHAT_MEMBER = 'unbanChatMember';
case RESTRICT_CHAT_MEMBER = 'restrictChatMember';
case PROMOTE_CHAT_MEMBER = 'promoteChatMember';
case SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE = 'setChatAdministratorCustomTitle';
case BAN_CHAT_SENDER_CHAT = 'banChatSenderChat';
case UNBAN_CHAT_SENDER_CHAT = 'unbanChatSenderChat';
case SET_CHAT_PERMISSIONS = 'setChatPermissions';
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
case CREATE_CHAT_SUBSCRIPTION_INVITE_LINK = 'createChatSubscriptionInviteLink';
case EDIT_CHAT_SUBSCRIPTION_INVITE_LINK = 'editChatSubscriptionInviteLink';
case REVOKE_CHAT_INVITE_LINK = 'revokeChatInviteLink';
case APPROVE_CHAT_JOIN_REQUEST = 'approveChatJoinRequest';
case DECLINE_CHAT_JOIN_REQUEST = 'declineChatJoinRequest';
case SET_CHAT_PHOTO = 'setChatPhoto';
case DELETE_CHAT_PHOTO = 'deleteChatPhoto';
case SET_CHAT_TITLE = 'setChatTitle';
case SET_CHAT_DESCRIPTION = 'setChatDescription';
case PIN_CHAT_MESSAGE = 'pinChatMessage';
case UNPIN_CHAT_MESSAGE = 'unpinChatMessage';
case UNPIN_ALL_CHAT_MESSAGES = 'unpinAllChatMessages';
case LEAVE_CHAT = 'leaveChat';
case GET_CHAT = 'getChat';
case GET_CHAT_ADMINISTRATORS = 'getChatAdministrators';
case GET_CHAT_MEMBER_COUNT = 'getChatMemberCount';
case GET_CHAT_MEMBER = 'getChatMember';
case SET_CHAT_STICKER_SET = 'setChatStickerSet';
case DELETE_CHAT_STICKER_SET = 'deleteChatStickerSet';
case GET_FORUM_TOPIC_ICON_STICKERS = 'getForumTopicIconStickers';
case CREATE_FORUM_TOPIC = 'createForumTopic';
case EDIT_FORUM_TOPIC = 'editForumTopic';
case CLOSE_FORUM_TOPIC = 'closeForumTopic';
case REOPEN_FORUM_TOPIC = 'reopenForumTopic';
case DELETE_FORUM_TOPIC = 'deleteForumTopic';
case UNPIN_ALL_FORUM_TOPIC_MESSAGES = 'unpinAllForumTopicMessages';
case EDIT_GENERAL_FORUM_TOPIC = 'editGeneralForumTopic';
case CLOSE_GENERAL_FORUM_TOPIC = 'closeGeneralForumTopic';
case REOPEN_GENERAL_FORUM_TOPIC = 'reopenGeneralForumTopic';
case HIDE_GENERAL_FORUM_TOPIC = 'hideGeneralForumTopic';
case UNHIDE_GENERAL_FORUM_TOPIC = 'unhideGeneralForumTopic';
case UNPIN_ALL_GENERAL_FORUM_TOPIC_MESSAGES = 'unpinAllGeneralForumTopicMessages';
case ANSWER_CALLBACK_QUERY = 'answerCallbackQuery';
case GET_USER_CHAT_BOOSTS = 'getUserChatBoosts';
case GET_BUSINESS_CONNECTION = 'getBusinessConnection';
case SET_MY_COMMANDS = 'setMyCommands';
case DELETE_MY_COMMANDS = 'deleteMyCommands';
case GET_MY_COMMANDS = 'getMyCommands';
case SET_MY_NAME = 'setMyName';
case GET_MY_NAME = 'getMyName';
case SET_MY_DESCRIPTION = 'setMyDescription';
case GET_MY_DESCRIPTION = 'getMyDescription';
case SET_MY_SHORT_DESCRIPTION = 'setMyShortDescription';
case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription';
case SET_CHAT_MENU_BUTTON = 'setChatMenuButton';
case GET_CHAT_MENU_BUTTON = 'getChatMenuButton';
case SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS = 'setMyDefaultAdministratorRights';
case GET_MY_DEFAULT_ADMINISTRATOR_RIGHTS = 'getMyDefaultAdministratorRights';
case EDIT_MESSAGE_TEXT = 'editMessageText';
case EDIT_MESSAGE_CAPTION = 'editMessageCaption';
case EDIT_MESSAGE_MEDIA = 'editMessageMedia';
case EDIT_MESSAGE_LIVE_LOCATION = 'editMessageLiveLocation';
case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation';
case EDIT_MESSAGE_REPLY_MARKUP = 'editMessageReplyMarkup';
case STOP_POLL = 'stopPoll';
case DELETE_MESSAGE = 'deleteMessage';
case DELETE_MESSAGES = 'deleteMessages';
case SEND_STICKER = 'sendSticker';
case GET_STICKER_SET = 'getStickerSet';
case GET_CUSTOM_EMOJI_STICKERS = 'getCustomEmojiStickers';
case UPLOAD_STICKER_FILE = 'uploadStickerFile';
case CREATE_NEW_STICKER_SET = 'createNewStickerSet';
case ADD_STICKER_TO_SET = 'addStickerToSet';
case SET_STICKER_POSITION_IN_SET = 'setStickerPositionInSet';
case DELETE_STICKER_FROM_SET = 'deleteStickerFromSet';
case REPLACE_STICKER_IN_SET = 'replaceStickerInSet';
case SET_STICKER_EMOJI_LIST = 'setStickerEmojiList';
case SET_STICKER_MASK_POSITION = 'setStickerMaskPosition';
case SET_STICKER_SET_TITLE = 'setStickerSetTitle';
case SET_STICKER_SET_THUMBNAIL = 'setStickerSetThumbnail';
case SET_CUSTOM_EMOJI_STICKER_SET_THUMBNAIL = 'setCustomEmojiStickerSetThumbnail';
case DELETE_STICKER_SET = 'deleteStickerSet';
case GET_AVAILABLE_GIFTS = 'getAvailableGifts';
case SEND_GIFT = 'sendGift';
case ANSWER_INLINE_QUERY = 'answerInlineQuery';
case ANSWER_WEB_APP_QUERY = 'answerWebAppQuery';
case SAVE_PREPARED_INLINE_MESSAGE = 'savePreparedInlineMessage';
case SEND_INVOICE = 'sendInvoice';
case CREATE_INVOICE_LINK = 'createInvoiceLink';
case ANSWER_SHIPPING_QUERY = 'answerShippingQuery';
case ANSWER_PRE_CHECKOUT_QUERY = 'answerPreCheckoutQuery';
case GET_STAR_TRANSACTIONS = 'getStarTransactions';
case SET_PASSPORT_DATA_ERRORS = 'setPassportDataErrors';
case SEND_GAME = 'sendGame';
case SET_GAME_SCORE = 'setGameScore';
case GET_GAME_HIGH_SCORES = 'getGameHighScores';
/**
* Executes a command on the provided bot with the given parameters.
*
* @param Bot $bot The bot instance on which the command will be executed.
* @param array $parameters Optional parameters for the command.
* @return ObjectTypeInterface|mixed The result of the command execution, varies based on the command.
* @throws TelegramException if the command execution fails.
*/
public function execute(Bot $bot, array $parameters=[]): mixed
{
return match($this)
{
self::GET_UPDATES => GetUpdates::execute($bot, $parameters),
self::SET_WEBHOOK => SetWebhook::execute($bot, $parameters),
self::DELETE_WEBHOOK => DeleteWebhook::execute($bot, $parameters),
self::GET_WEBHOOK_INFO => GetWebhookInfo::execute($bot, $parameters),
self::GET_ME => GetMe::execute($bot, $parameters),
self::LOGOUT => LogOut::execute($bot, $parameters),
self::CLOSE => Close::execute($bot, $parameters),
self::SEND_MESSAGE => SendMessage::execute($bot, $parameters),
self::FORWARD_MESSAGE => ForwardMessage::execute($bot, $parameters),
self::FORWARD_MESSAGES => ForwardMessages::execute($bot, $parameters),
self::COPY_MESSAGE => CopyMessage::execute($bot, $parameters),
self::COPY_MESSAGES => CopyMessages::execute($bot, $parameters),
self::SEND_PHOTO => SendPhoto::execute($bot, $parameters),
self::SEND_AUDIO => SendAudio::execute($bot, $parameters),
self::SEND_DOCUMENT => SendDocument::execute($bot, $parameters),
self::SEND_VIDEO => SendVideo::execute($bot, $parameters),
self::SEND_ANIMATION => SendAnimation::execute($bot, $parameters),
self::SEND_VOICE => SendVoice::execute($bot, $parameters),
self::SEND_VIDEO_NOTE => SendVideoNote::execute($bot, $parameters),
self::SEND_PAID_MEDIA => SendPaidMedia::execute($bot, $parameters),
self::SEND_MEDIA_GROUP => SendMediaGroup::execute($bot, $parameters),
self::SEND_LOCATION => SendLocation::execute($bot, $parameters),
self::SEND_VENUE => SendVenue::execute($bot, $parameters),
self::SEND_CONTACT => SendContact::execute($bot, $parameters),
self::SEND_POLL => SendPoll::execute($bot, $parameters),
self::SEND_DICE => SendDice::execute($bot, $parameters),
self::SEND_CHAT_ACTION => SendChatAction::execute($bot, $parameters),
self::SET_MESSAGE_REACTION => SetMessageReaction::execute($bot, $parameters),
self::GET_USER_PROFILE_PHOTOS => GetUserProfilePhotos::execute($bot, $parameters),
self::GET_FILE => GetFile::execute($bot, $parameters),
self::BAN_CHAT_MEMBER => BanChatMember::execute($bot, $parameters),
self::UNBAN_CHAT_MEMBER => UnbanChatMember::execute($bot, $parameters),
self::RESTRICT_CHAT_MEMBER => RestrictChatMember::execute($bot, $parameters),
self::PROMOTE_CHAT_MEMBER => PromoteChatMember::execute($bot, $parameters),
self::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE => SetChatAdministratorCustomTitle::execute($bot, $parameters),
self::BAN_CHAT_SENDER_CHAT => BanChatSenderChat::execute($bot, $parameters),
self::UNBAN_CHAT_SENDER_CHAT => UnbanChatSenderChat::execute($bot, $parameters),
self::SET_CHAT_PERMISSIONS => SetChatPermissions::execute($bot, $parameters),
self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters),
self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters),
self::EDIT_CHAT_INVITE_LINK => EditChatInviteLink::execute($bot, $parameters),
self::CREATE_CHAT_SUBSCRIPTION_INVITE_LINK => CreateChatSubscriptionInviteLink::execute($bot, $parameters),
self::EDIT_CHAT_SUBSCRIPTION_INVITE_LINK => EditChatSubscriptionInviteLink::execute($bot, $parameters),
self::REVOKE_CHAT_INVITE_LINK => RevokeChatInviteLink::execute($bot, $parameters),
self::APPROVE_CHAT_JOIN_REQUEST => ApproveChatJoinRequest::execute($bot, $parameters),
self::DECLINE_CHAT_JOIN_REQUEST => DeclineChatJoinRequest::execute($bot, $parameters),
self::SET_CHAT_PHOTO => SetChatPhoto::execute($bot, $parameters),
self::DELETE_CHAT_PHOTO => DeleteChatPhoto::execute($bot, $parameters),
self::SET_CHAT_TITLE => SetChatTitle::execute($bot, $parameters),
self::SET_CHAT_DESCRIPTION => SetChatDescription::execute($bot, $parameters),
self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters),
self::UNPIN_CHAT_MESSAGE => UnpinChatMessage::execute($bot, $parameters),
self::UNPIN_ALL_CHAT_MESSAGES => UnpinAllChatMessages::execute($bot, $parameters),
self::LEAVE_CHAT => LeaveChat::execute($bot, $parameters),
self::GET_CHAT => GetChat::execute($bot, $parameters),
self::GET_CHAT_ADMINISTRATORS => GetChatAdministrators::execute($bot, $parameters),
self::GET_CHAT_MEMBER_COUNT => GetChatMemberCount::execute($bot, $parameters),
self::GET_CHAT_MEMBER => GetChatMember::execute($bot, $parameters),
self::SET_CHAT_STICKER_SET => SetChatStickerSet::execute($bot, $parameters),
self::DELETE_CHAT_STICKER_SET => DeleteChatStickerSet::execute($bot, $parameters),
self::GET_FORUM_TOPIC_ICON_STICKERS => GetForumTopicIconStickers::execute($bot, $parameters),
self::CREATE_FORUM_TOPIC => CreateForumTopic::execute($bot, $parameters),
self::EDIT_FORUM_TOPIC => EditForumTopic::execute($bot, $parameters),
self::CLOSE_FORUM_TOPIC => CloseForumTopic::execute($bot, $parameters),
self::REOPEN_FORUM_TOPIC => ReopenForumTopic::execute($bot, $parameters),
self::DELETE_FORUM_TOPIC => DeleteForumTopic::execute($bot, $parameters),
self::UNPIN_ALL_FORUM_TOPIC_MESSAGES => UnpinAllForumTopicMessages::execute($bot, $parameters),
self::EDIT_GENERAL_FORUM_TOPIC => EditGeneralForumTopic::execute($bot, $parameters),
self::CLOSE_GENERAL_FORUM_TOPIC => CloseGeneralForumTopic::execute($bot, $parameters),
self::REOPEN_GENERAL_FORUM_TOPIC => ReopenGeneralForumTopic::execute($bot, $parameters),
self::HIDE_GENERAL_FORUM_TOPIC => HideGeneralForumTopic::execute($bot, $parameters),
self::UNHIDE_GENERAL_FORUM_TOPIC => UnhideGeneralForumTopic::execute($bot, $parameters),
self::UNPIN_ALL_GENERAL_FORUM_TOPIC_MESSAGES => UnpinAllGeneralForumTopicMessages::execute($bot, $parameters),
self::ANSWER_CALLBACK_QUERY => AnswerCallbackQuery::execute($bot, $parameters),
self::GET_USER_CHAT_BOOSTS => GetUserChatBoosts::execute($bot, $parameters),
self::GET_BUSINESS_CONNECTION => GetBusinessConnection::execute($bot, $parameters),
self::SET_MY_COMMANDS => SetMyCommands::execute($bot, $parameters),
self::DELETE_MY_COMMANDS => DeleteMyCommands::execute($bot, $parameters),
self::GET_MY_COMMANDS => GetMyCommands::execute($bot, $parameters),
self::SET_MY_NAME => SetMyName::execute($bot, $parameters),
self::GET_MY_NAME => GetMyName::execute($bot, $parameters),
self::SET_MY_DESCRIPTION => SetMyDescription::execute($bot, $parameters),
self::GET_MY_DESCRIPTION => GetMyDescription::execute($bot, $parameters),
self::SET_MY_SHORT_DESCRIPTION => SetMyShortDescription::execute($bot, $parameters),
self::GET_MY_SHORT_DESCRIPTION => GetMyShortDescription::execute($bot, $parameters),
self::SET_CHAT_MENU_BUTTON => SetChatMenuButton::execute($bot, $parameters),
self::GET_CHAT_MENU_BUTTON => GetChatMenuButton::execute($bot, $parameters),
self::SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS => SetMyDefaultAdministratorRights::execute($bot, $parameters),
self::GET_MY_DEFAULT_ADMINISTRATOR_RIGHTS => GetMyDefaultAdministratorRights::execute($bot, $parameters),
self::EDIT_MESSAGE_TEXT => EditMessageText::execute($bot, $parameters),
self::EDIT_MESSAGE_CAPTION => EditMessageCaption::execute($bot, $parameters),
self::EDIT_MESSAGE_MEDIA => EditMessageMedia::execute($bot, $parameters),
self::EDIT_MESSAGE_LIVE_LOCATION => EditMessageLiveLocation::execute($bot, $parameters),
self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters),
self::EDIT_MESSAGE_REPLY_MARKUP => EditMessageReplyMarkup::execute($bot, $parameters),
self::STOP_POLL => StopPoll::execute($bot, $parameters),
self::DELETE_MESSAGE => DeleteMessage::execute($bot, $parameters),
self::DELETE_MESSAGES => DeleteMessages::execute($bot, $parameters),
self::SEND_STICKER => SendSticker::execute($bot, $parameters),
self::GET_STICKER_SET => GetStickerSet::execute($bot, $parameters),
self::GET_CUSTOM_EMOJI_STICKERS => GetCustomEmojiStickers::execute($bot, $parameters),
self::UPLOAD_STICKER_FILE => UploadStickerFile::execute($bot, $parameters),
self::CREATE_NEW_STICKER_SET => CreateNewStickerSet::execute($bot, $parameters),
self::ADD_STICKER_TO_SET => AddStickerToSet::execute($bot, $parameters),
self::SET_STICKER_POSITION_IN_SET => SetStickerPositionInSet::execute($bot, $parameters),
self::DELETE_STICKER_FROM_SET => DeleteStickerFromSet::execute($bot, $parameters),
self::REPLACE_STICKER_IN_SET => ReplaceStickerInSet::execute($bot, $parameters),
self::SET_STICKER_EMOJI_LIST => SetStickerEmojiList::execute($bot, $parameters),
self::SET_STICKER_MASK_POSITION => SetStickerMaskPosition::execute($bot, $parameters),
self::SET_STICKER_SET_TITLE => SetStickerSetTitle::execute($bot, $parameters),
self::SET_STICKER_SET_THUMBNAIL => SetStickerSetThumbnail::execute($bot, $parameters),
self::SET_CUSTOM_EMOJI_STICKER_SET_THUMBNAIL => SetCustomEmojiStickerSetThumbnail::execute($bot, $parameters),
self::DELETE_STICKER_SET => DeleteStickerSet::execute($bot, $parameters),
self::GET_AVAILABLE_GIFTS => GetAvailableGifts::execute($bot, $parameters),
self::SEND_GIFT => SendGift::execute($bot, $parameters),
self::ANSWER_INLINE_QUERY => AnswerInlineQuery::execute($bot, $parameters),
self::ANSWER_WEB_APP_QUERY => AnswerWebAppQuery::execute($bot, $parameters),
self::SAVE_PREPARED_INLINE_MESSAGE => SavePreparedInlineMessage::execute($bot, $parameters),
self::SEND_INVOICE => SendInvoice::execute($bot, $parameters),
self::CREATE_INVOICE_LINK => CreateInvoiceLink::execute($bot, $parameters),
self::ANSWER_SHIPPING_QUERY => AnswerShippingQuery::execute($bot, $parameters),
self::ANSWER_PRE_CHECKOUT_QUERY => AnswerPreCheckoutQuery::execute($bot, $parameters),
self::GET_STAR_TRANSACTIONS => GetStarTransactions::execute($bot, $parameters),
self::SET_PASSPORT_DATA_ERRORS => SetPassportDataErrors::execute($bot, $parameters),
self::SEND_GAME => SendGame::execute($bot, $parameters),
self::SET_GAME_SCORE => SetGameScore::execute($bot, $parameters),
self::GET_GAME_HIGH_SCORES => GetGameHighScores::execute($bot, $parameters)
};
}
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum BackgroundFillType : string
{
case SOLID = 'solid';
case GRADIENT = 'gradient';
case FREEFORM_GRADIENT = 'freeform_gradient';
}

View file

@ -0,0 +1,11 @@
<?php
namespace TgBotLib\Enums\Types;
enum BackgroundType : string
{
case FILL = 'fill';
case WALLPAPER = 'wallpaper';
case PATTERN = 'pattern';
case CHAT_THEME = 'chat_theme';
}

View file

@ -0,0 +1,14 @@
<?php
namespace TgBotLib\Enums\Types;
enum BotCommandScopeType : string
{
case DEFAULT = 'default';
case ALL_PRIVATE_CHATS = 'all_private_chats';
case ALL_CHAT_GROUPS = 'all_group_chats';
case ALL_CHAT_ADMINISTRATORS = 'all_chat_administrators';
case CHAT = 'chat';
case CHAT_ADMINISTRATORS = 'chat_administrators';
case CHAT_MEMBER = 'chat_member';
}

View file

@ -0,0 +1,16 @@
<?php
namespace TgBotLib\Enums\Types;
enum ChatActionType : string
{
case TYPING = 'typing';
case UPLOAD_PHOTO = 'upload_photo';
case RECORD_VIDEO = 'record_video';
case UPLOAD_VIDEO = 'upload_video';
case RECORD_VOICE = 'record_voice';
case CHOOSE_STICKER = 'choose_sticker';
case FIND_LOCATION = 'find_location';
case RECORD_VIDEO_NOTE = 'record_video_note';
case UPLOAD_VIDEO_NOTE = 'upload_video_note';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum ChatBoostSourceType : string
{
case PREMIUM = 'premium';
case GIFT_CODE = 'gift_code';
case GIVEAWAY = 'giveaway';
}

View file

@ -0,0 +1,13 @@
<?php
namespace TgBotLib\Enums\Types;
enum ChatMemberStatus : string
{
case CREATOR = 'creator';
case ADMINISTRATOR = 'administrator';
case MEMBER = 'member';
case RESTRICTED = 'restricted';
case LEFT = 'left';
case KICKED = 'kicked';
}

View file

@ -0,0 +1,11 @@
<?php
namespace TgBotLib\Enums\Types;
enum ChatType : string
{
case PRIVATE = 'private';
case GROUP = 'group';
case SUPERGROUP = 'supergroup';
case CHANNEL = 'channel';
}

View file

@ -0,0 +1,66 @@
<?php
namespace TgBotLib\Enums\Types;
enum InlineQueryResultType : string
{
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultarticle
*/
case ARTICLE = 'article';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultphoto
*/
case PHOTO = 'photo';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultgif
*/
case GIF = 'gif';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
*/
case MPEG_4_GIF = 'mpeg4_gif';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultvideompeg4
*/
case VIDEO = 'video';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultaudio
*/
case AUDIO = 'audio';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultvoice
*/
case VOICE = 'voice';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultdocument
*/
case DOCUMENT = 'document';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultlocation
*/
case LOCATION = 'location';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultvenue
*/
case VENUE = 'venue';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultcontact
*/
case CONTACT = 'contact';
/**
* @link https://core.telegram.org/bots/api#inlinequeryresultgame
*/
case GAME = 'game';
}

View file

@ -0,0 +1,12 @@
<?php
namespace TgBotLib\Enums\Types;
enum InputMediaType : string
{
case PHOTO = 'photo';
case VIDEO = 'video';
case ANIMATION = 'animation';
case AUDIO = 'audio';
case DOCUMENT = 'document';
}

View file

@ -0,0 +1,12 @@
<?php
namespace TgBotLib\Enums\Types;
enum InputMessageContentType : string
{
case TEXT = 'text';
case LOCATION = 'location';
case VENUE = 'venue';
case CONTACT = 'contact';
case INVOICE = 'invoice';
}

View file

@ -0,0 +1,9 @@
<?php
namespace TgBotLib\Enums\Types;
enum KeyboardButtonPollType : string
{
case QUIZ = 'quiz';
case REGULAR = 'regular';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum MenuButtonType : string
{
case COMMANDS = 'commands';
case WEB_APP = 'web_app';
case DEFAULT = 'default';
}

View file

@ -0,0 +1,41 @@
<?php
namespace TgBotLib\Enums\Types;
enum MessageEntityType : string
{
case MENTION = 'mention';
case HASHTAG = 'hashtag';
case CASHTAG = 'cashtag';
case BOT_COMMAND = 'bot_command';
case URL = 'url';
case EMAIL = 'email';
case PHONE_NUMBER = 'phone_number';
case BOLD = 'bold';
case ITALIC = 'italic';
case UNDERLINE = 'underline';
case STRIKETHROUGH = 'strikethrough';
case SPOILER = 'spoiler';
case CODE = 'code';
case PRE = 'pre';
case TEXT_LINK = 'text_link';
case TEXT_MENTION = 'text_mention';
case CUSTOM_EMOJI = 'custom_emoji';
}

View file

@ -0,0 +1,11 @@
<?php
namespace TgBotLib\Enums\Types;
enum MessageOriginType : string
{
case USER = 'user';
case HIDDEN_USER = 'hidden_user';
case CHAT = 'chat';
case CHANNEL = 'channel';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum PaidMediaType : string
{
case PREVIEW = 'preview';
case PHOTO = 'photo';
case VIDEO = 'video';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum ParseMode : string
{
case HTML = 'HTML';
case MARKDOWN = 'Markdown';
case MARKDOWN_V2 = 'MarkdownV2';
}

View file

@ -0,0 +1,16 @@
<?php
namespace TgBotLib\Enums\Types;
enum PassportElementErrorSourceType : string
{
case DATA = 'data';
case FRONT_SIDE = 'front_side';
case REVERSE_SIDE = 'reverse_side';
case SELFIE = 'selfie';
case FILE = 'file';
case FILES = 'files';
case TRANSLATION_FILE = 'translation_file';
case TRANSLATION_FILES = 'translation_files';
case UNSPECIFIED = 'unspecified';
}

View file

@ -0,0 +1,13 @@
<?php
namespace TgBotLib\Enums\Types;
enum PassportElementErrorType : string
{
case PERSONAL_DETAILS = 'personal_details';
case PASSPORT = 'passport';
case DRIVER_LICENSE = 'driver_license';
case IDENTITY_CARD = 'identity_card';
case INTERNAL_PASSPORT = 'internal_passport';
case ADDRESS = 'address';
}

View file

@ -0,0 +1,20 @@
<?php
namespace TgBotLib\Enums\Types;
enum PassportElementType : string
{
case PERSONAL_DETAILS = 'personal_details';
case PASSPORT = 'passport';
case DRIVER_LICENSE = 'driver_license';
case IDENTITY_CARD = 'identity_card';
case INTERNAL_PASSPORT = 'internal_passport';
case ADDRESS = 'address';
case UTILITY_BILL = 'utility_bill';
case BANK_STATEMENT = 'bank_statement';
case RENTAL_AGREEMENT = 'rental_agreement';
case PASSPORT_REGISTRATION = 'passport_registration';
case TEMPORARY_REGISTRATION = 'temporary_registration';
case PHONE_NUMBER = 'phone_number';
case EMAIL = 'email';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum PollType : string
{
case REGULAR = 'regular';
case QUIZ = 'quiz';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum ReactionTypes : string
{
case EMOJI = 'emoji';
case CUSTOM_EMOJI = 'custom_emoji';
case PAID = 'paid';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum RevenueWithdrawalType : string
{
case PENDING = 'pending';
case SUCCEEDED = 'succeed';
case FAILED = 'failed';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum StickerFormat : string
{
case STATIC = 'static';
case ANIMATED = 'animated';
case VIDEO = 'video';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum StickerType : string
{
case REGULAR = 'regular';
case MASK = 'mask';
case CUSTOM_EMOJI = 'custom_emoji';
}

View file

@ -0,0 +1,10 @@
<?php
namespace TgBotLib\Enums\Types;
enum ThumbnailMimeType : string
{
case IMAGE_JPEG = 'image/jpeg';
case IMAGE_GIF = 'image/gif';
case VIDEO_MP4 = 'video/mp4';
}

View file

@ -0,0 +1,11 @@
<?php
namespace TgBotLib\Enums\Types;
enum TransactionPartnerType : string
{
case USER = 'user';
case FRAGMENT = 'fragment';
case TELEGRAM_ADS = 'telegram_ads';
case OTHER = 'other';
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\BusinessConnection;
abstract class BusinessConnectionEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::BUSINESS_CONNECTION;
}
/**
* Fetches the BusinessConnection instance associated with this update.
*
* @return BusinessConnection The business connection associated with this update.
*/
protected function getBusinessConnection(): BusinessConnection
{
return $this->update->getBusinessConnection();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class BusinessMessageEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::BUSINESS_MESSAGE;
}
/**
* New incoming business message
*
* @return Message
*/
protected function getBusinessMessage(): Message
{
return $this->update->getBusinessMessage();
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace TgBotLib\Events;
use LogicException;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\CallbackQuery;
abstract class CallbackQueryEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::CALLBACK_QUERY;
}
/**
* Retrieves data associated with the callback.
*
* @return string
*/
public abstract static function getCallbackData(): string;
/**
* New incoming callback query
*
* @return CallbackQuery
*/
protected function getCallbackQuery(): CallbackQuery
{
return $this->update->getCallbackQuery();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class ChannelPostEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::CHANNEL_POST;
}
/**
* Retrieves the current channel post.
*
* @return Message The channel post message.
*/
protected function getChannelPost(): Message
{
return $this->update->getChannelPost();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\ChatBoostUpdated;
abstract class ChatBoostEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::CHAT_BOOST_EVENT;
}
/**
* A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.
*
* @return ChatBoostUpdated The updated chat boost information.
*/
protected function getChatBoost(): ChatBoostUpdated
{
return $this->update->getChatBoost();
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\ChatJoinRequest;
abstract class ChatJoinRequestEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::CHAT_JOIN_REQUEST_EVENT;
}
/**
* A request to join the chat has been sent. The bot must have the can_invite_users
* administrator right in the chat to receive these updates.
*
* @return ChatJoinRequest The chat join request data.
*/
protected function getChatJoinRequest(): ChatJoinRequest
{
return $this->update->getChatJoinRequest();
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\ChatMemberUpdated;
abstract class ChatMemberUpdatedEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::CHAT_MEMBER_UPDATED;
}
/**
* A chat member's status was updated in a chat. The bot must be an administrator in the chat and must
* explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
*
* @return ChatMemberUpdated The updated chat member instance.
*/
protected function getChatMemberUpdated(): ChatMemberUpdated
{
return $this->update->getChatMember();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Inline\ChosenInlineResult;
abstract class ChosenInlineResultEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::CHOSEN_INLINE_RESULT;
}
/**
* The result of an inline query that was chosen by a user and sent to their chat partner.
*
* @return ChosenInlineResult The chosen inline result associated with the current update.
*/
protected function getChosenInlineResult(): ChosenInlineResult
{
return $this->update->getChosenInlineResult();
}
}

View file

@ -0,0 +1,63 @@
<?php
namespace TgBotLib\Events;
use OptsLib\Parse;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class CommandEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::COMMAND;
}
/**
* Retrieve the command to be executed.
*
* In the format of a string, this method should return the command to be executed.
* for example if the command is "/start", this method should return "start".
*
* @return string The command to be executed.
*/
public abstract static function getCommand(): string;
/**
* Retrieves the message from the update.
*
* @return Message The message contained within the update.
*/
protected function getMessage(): Message
{
return $this->update->getAnyMessage();
}
/**
* Extracts and returns the arguments of the command from the message text.
*
* @return string The arguments of the command.
*/
protected function getArguments(): string
{
if(strlen($this->getMessage()->getCommand()) <= strlen(static::getCommand()) + 1)
{
return '';
}
return substr($this->getMessage()->getCommand(), strlen(static::getCommand()) + 1);
}
/**
* Parses and returns the command arguments as an array.
*
* @return array The parsed command arguments.
*/
protected function getParsedArguments(): array
{
return Parse::parseArgument($this->getArguments());
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\BusinessMessagesDeleted;
abstract class DeletedBusinessMessagesEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::DELETED_BUSINESS_MESSAGES;
}
/**
* Messages were deleted from a connected business account
*
* @return BusinessMessagesDeleted
*/
protected function getBusinessMessagesDeleted(): BusinessMessagesDeleted
{
return $this->update->getDeletedBusinessMessages();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class EditedBusinessMessageEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::EDITED_BUSINESS_MESSAGE;
}
/**
* New incoming edited business message
*
* @return Message
*/
protected function getEditedBusinessMessage(): Message
{
return $this->update->getEditedBusinessMessage();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class EditedChannelPostEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::EDITED_CHANNEL_POST;
}
/**
* Retrieves the edited channel post from the update.
*
* @return Message The edited channel post.
*/
protected function getEditedChannelPost(): Message
{
return $this->update->getEditedChannelPost();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class EditedMessageEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::EDITED_MESSAGE;
}
/**
* Retrieves the current edited message.
*
* @return Message The edited message.
*/
protected function getEditedMessage(): Message
{
return $this->update->getEditedMessage();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Inline\InlineQuery;
abstract class InlineQueryEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::INLINE_QUERY;
}
/**C
* New incoming inline query
*
* @return InlineQuery
*/
protected function getInlineQuery(): InlineQuery
{
return $this->update->getInlineQuery();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Message;
abstract class MessageEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::MESSAGE;
}
/**
* Retrieves the current message.
*
* @return Message The message.
*/
protected function getMessage(): Message
{
return $this->update->getMessage();
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\MessageReactionCountUpdated;
abstract class MessageReactionCountEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::MESSAGE_REACTION_COUNT;
}
/**
* Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat
* and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates.
* The updates are grouped and can be sent with delay up to a few minutes.
*
* @return MessageReactionCountUpdated
*/
protected function getMessageReactionCount(): MessageReactionCountUpdated
{
return $this->update->getMessageReactionCount();
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\MessageReactionUpdated;
abstract class MessageReactionEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::MESSAGE_REACTION;
}
/**
* A reaction to a message was changed by a user. The bot must be an administrator in the chat and must
* explicitly specify "message_reaction" in the list of allowed_updates to receive these updates.
* The update isn't received for reactions set by bots.
*
* @return MessageReactionUpdated
*/
protected function getMessageReactionUpdated(): MessageReactionUpdated
{
return $this->update->getMessageReaction();
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\ChatMemberUpdated;
abstract class MyChatMemberUpdatedEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::MY_CHAT_MEMBER_UPDATED;
}
/**
* The bot's chat member status was updated in a chat. For private chats,
* this update is received only when the bot is blocked or unblocked by the user.
*
* @return ChatMemberUpdated The updated chat member information.
*/
protected function getMyChatMemberUpdated(): ChatMemberUpdated
{
return $this->update->getMyChatMember();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Payments\PaidMediaPurchased;
abstract class PaidMediaPurchasedEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::PAID_MEDIA_PURCHASED;
}
/**
* A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat
*
* @return PaidMediaPurchased
*/
protected function getPurchasedPaidMedia(): PaidMediaPurchased
{
return $this->update->getPurchasedPaidMedia();
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\PollAnswer;
abstract class PollAnswerEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::POLL_ANSWER;
}
/**
* A user changed their answer in a non-anonymous poll.
* Bots receive new votes only in polls that were sent by the bot itself.
*
* @return PollAnswer The poll answer associated with the current update.
*/
protected function getPollAnswer(): PollAnswer
{
return $this->update->getPollAnswer();
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Poll;
abstract class PollEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::POLL;
}
/**
* A user changed their answer in a non-anonymous poll.
* Bots receive new votes only in polls that were sent by the bot itself.
*
* @return Poll The poll.
*/
protected function getPoll(): Poll
{
return $this->update->getPoll();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Payments\PreCheckoutQuery;
abstract class PreCheckoutQueryEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::PRE_CHECKOUT_QUERY;
}
/**
* New incoming pre-checkout query. Contains full information about checkout
*
* @return PreCheckoutQuery
*/
protected function getPreCheckoutQuery(): PreCheckoutQuery
{
return $this->update->getPreCheckoutQuery();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\ChatBoostRemoved;
abstract class RemovedChatBoostEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::REMOVED_CHAT_BOOST_EVENT;
}
/**
* A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.
*
* @return ChatBoostRemoved The chat boost that was removed.
*/
protected function getChatBoostRemoved(): ChatBoostRemoved
{
return $this->update->getRemovedChatBoost();
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Enums\EventType;
use TgBotLib\Objects\Payments\ShippingQuery;
abstract class ShippingQueryEvent extends UpdateEvent
{
/**
* @inheritDoc
*/
public static function getEventType(): EventType
{
return EventType::SHIPPING_QUERY;
}
/**
* New incoming shipping query. Only for invoices with flexible price
*
* @return ShippingQuery
*/
protected function getShippingQuery(): ShippingQuery
{
return $this->update->getShippingQuery();
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace TgBotLib\Events;
use TgBotLib\Bot;
use TgBotLib\Enums\EventType;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Objects\Update;
abstract class UpdateEvent
{
protected Update $update;
/**
* Constructor for the class.
*
* @param Update $update The update instance to be used.
* @return void
*/
public function __construct(Update $update)
{
$this->update = $update;
}
/**
* Retrieves the event type.
* @return EventType The event type of the current instance.
*/
public static function getEventType(): EventType
{
return EventType::UPDATE_EVENT;
}
/**
* Abstract method to handle the bot instance.
*
* @param Bot $bot The bot instance to be handled.
* @return void
* @throws TelegramException
*/
public abstract function handle(Bot $bot): void;
}

View file

@ -0,0 +1,13 @@
<?php
namespace TgBotLib\Exceptions;
use Throwable;
class NotImplementedException extends \Exception
{
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

View file

@ -16,6 +16,6 @@
*/
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
parent::__construct(sprintf("%s (Error code %s)", $message, $code), $code, $previous);
}
}

View file

@ -2,17 +2,17 @@
namespace TgBotLib\Interfaces;
use TgBotLib\Bot;
use TgBotLib\Objects\Telegram\Update;
use TgBotLib\BotOld;
use TgBotLib\Objects\Update;
interface CommandInterface
{
/**
* Execute the command
*
* @param Bot $bot
* @param BotOld $bot
* @param Update $update
* @return void
*/
public function handle(Bot $bot, Update $update): void;
public function handle(BotOld $bot, Update $update): void;
}

View file

@ -2,17 +2,17 @@
namespace TgBotLib\Interfaces;
use TgBotLib\Bot;
use TgBotLib\Objects\Telegram\Update;
use TgBotLib\BotOld;
use TgBotLib\Objects\Update;
interface EventInterface
{
/**
* Execute the command
*
* @param Bot $bot
* @param BotOld $bot
* @param Update $update
* @return void
*/
public function handle(Bot $bot, Update $update): void;
public function handle(BotOld $bot, Update $update): void;
}

View file

@ -7,15 +7,15 @@
/**
* Returns an array representation of the object
*
* @return array
* @return array|null
*/
public function toArray(): array;
public function toArray(): ?array;
/**
* Reconstruction of the object from an array
*
* @param array $data
* @return ObjectTypeInterface
* @param array|null $data
* @return ObjectTypeInterface|null
*/
public static function fromArray(array $data): ObjectTypeInterface;
public static function fromArray(?array $data): ?ObjectTypeInterface;
}

View file

@ -0,0 +1,40 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Exceptions\NotImplementedException;
class AddStickerToSet extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
throw new NotImplementedException('Method not implemented yet, check back later');
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'user_id',
'name',
'sticker'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class AnswerCallbackQuery extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::ANSWER_CALLBACK_QUERY->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'callback_query_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'text',
'show_alert',
'url',
'cache_time'
];
}
}

View file

@ -0,0 +1,77 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Interfaces\ObjectTypeInterface;
class AnswerInlineQuery extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
if(isset($parameters['results']))
{
$results = [];
foreach($parameters['results'] as $result)
{
if($result instanceof ObjectTypeInterface)
{
$result[] = $result->toArray();
continue;
}
if(is_array($result))
{
$result[] = $result;
}
}
$parameters['results'] = json_encode($results);
}
if(isset($parameters['button']))
{
if($parameters['button'] instanceof ObjectTypeInterface)
{
$parameters['button'] = json_encode($parameters['button']->toArray());
}
if(is_array($parameters['button']))
{
$parameters['button'] = json_encode($parameters['button']);
}
}
return (bool)self::executeCurl(self::buildPost($bot, Methods::ANSWER_INLINE_QUERY->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'inline_query_id',
'results'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'cache_time',
'is_personal',
'next_offset',
'button'
];
}
}

View file

@ -0,0 +1,40 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class AnswerPreCheckoutQuery extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)self::executeCurl(self::buildPost($bot, Methods::ANSWER_PRE_CHECKOUT_QUERY->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'pre_checkout_query_id',
'ok'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'error_message'
];
}
}

View file

@ -0,0 +1,50 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Interfaces\ObjectTypeInterface;
class AnswerShippingQuery extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
if(isset($parameters['shipping_options']))
{
if($parameters['shipping_options'] instanceof ObjectTypeInterface)
{
$parameters['shipping_options'] = json_encode($parameters['shipping_options']->toArray());
}
}
return (bool)self::executeCurl(self::buildPost($bot, Methods::ANSWER_SHIPPING_QUERY->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'shipping_query_id',
'ok'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'shipping_options',
'error_message'
];
}
}

View file

@ -0,0 +1,53 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Interfaces\ObjectTypeInterface;
use TgBotLib\Objects\Inline\SentWebAppMessage;
class AnswerWebAppQuery extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): SentWebAppMessage
{
if(isset($parameters['result']))
{
if($parameters['result'] instanceof ObjectTypeInterface)
{
$parameters['result'] = json_encode($parameters['result']->toArray());
}
if(is_array($parameters['result']))
{
$parameters['result'] = json_encode($parameters['result']);
}
}
return SentWebAppMessage::fromArray(self::executeCurl(self::buildPost($bot, Methods::ANSWER_WEB_APP_QUERY->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'web_app_query_id',
'result'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}

View file

@ -0,0 +1,39 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\ChatInviteLink;
class ApproveChatJoinRequest extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)self::executeCurl(self::buildPost($bot, Methods::APPROVE_CHAT_JOIN_REQUEST->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'invite_link'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class BanChatMember extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)self::executeCurl(self::buildPost($bot, Methods::BAN_CHAT_MEMBER->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'user_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'until_date',
'revoke_messages'
];
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class BanChatSenderChat extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)self::executeCurl(self::buildPost($bot, Methods::BAN_CHAT_SENDER_CHAT->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'sender_chat_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Exceptions\TelegramException;
class Close extends Method
{
/**
* Use this method to close the bot instance before moving it from one local server to another.
* You need to delete the webhook before calling this method to ensure that the bot isn't launched again
* after server restart. The method will return error 429 in the first 10 minutes after the bot is launched.
* Returns True on success. Requires no parameters.
*
* @param Bot $bot
* @param array $parameters
* @return bool
* @throws TelegramException
*/
public static function execute(Bot $bot, array $parameters = []): bool
{
return (bool) self::executeCurl(self::buildPost($bot, Methods::CLOSE->value));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return null;
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}

Some files were not shown because too many files have changed in this diff Show more