diff --git a/README.md b/README.md index 551a444..bc33496 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ import('net.nosial.tgbotlib'); $bot = new TgBotLib\BotOld(''); -/** @var \TgBotLib\Objects\Telegram\Update $update */ +/** @var \TgBotLib\Objects\Update $update */ foreach ($bot->getUpdates() as $update) { $bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello World!'); @@ -152,7 +152,7 @@ To implement a single-threaded bot, it's very self-explanatory, you just need to // Loop forever while(true) { - /** @var \TgBotLib\Objects\Telegram\Update $update */ + /** @var \TgBotLib\Objects\Update $update */ foreach ($bot->getUpdates() as $update) { $bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello World!'); @@ -261,9 +261,7 @@ all the information about the update. namespace commands; - use TgBotLib\BotOld; - use TgBotLib\Interfaces\CommandInterface; - use TgBotLib\Objects\Telegram\Update; + use TgBotLib\BotOld;use TgBotLib\Interfaces\CommandInterface;use TgBotLib\Objects\Update; class StartCommand extends CommandInterface { @@ -296,9 +294,7 @@ And the interface EventInterface is used instead of CommandInterface: namespace events; - use TgBotLib\BotOld; - use TgBotLib\Interfaces\EventInterface; - use TgBotLib\Objects\Telegram\Update; + use TgBotLib\BotOld;use TgBotLib\Interfaces\EventInterface;use TgBotLib\Objects\Update; class MessageEvent implements EventInterface { diff --git a/src/TgBotLib/BotOld.php b/src/TgBotLib/BotOld.php index b04dd83..3f3f62f 100644 --- a/src/TgBotLib/BotOld.php +++ b/src/TgBotLib/BotOld.php @@ -15,36 +15,36 @@ use TgBotLib\Interfaces\CommandInterface; use TgBotLib\Interfaces\EventInterface; use TgBotLib\Interfaces\ObjectTypeInterface; - use TgBotLib\Objects\Telegram\BotCommandScope; - use TgBotLib\Objects\Telegram\BotDescription; - use TgBotLib\Objects\Telegram\BotShortDescription; - use TgBotLib\Objects\Telegram\Chat; - use TgBotLib\Objects\Telegram\ChatAdministratorRights; - use TgBotLib\Objects\Telegram\ChatInviteLink; - use TgBotLib\Objects\Telegram\ChatMember; - use TgBotLib\Objects\Telegram\File; - use TgBotLib\Objects\Telegram\ForumTopic; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultArticle; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultAudio; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultContact; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultDocument; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGame; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGif; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultLocation; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultMpeg4Gif; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultPhoto; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVenue; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVideo; - use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultVoice; - use TgBotLib\Objects\Telegram\MenuButton; - use TgBotLib\Objects\Telegram\Message; - use TgBotLib\Objects\Telegram\Poll; - use TgBotLib\Objects\Telegram\SentWebAppMessage; - use TgBotLib\Objects\Telegram\Sticker; - use TgBotLib\Objects\Telegram\Update; - use TgBotLib\Objects\Telegram\User; - use TgBotLib\Objects\Telegram\UserProfilePhotos; - use TgBotLib\Objects\Telegram\WebhookInfo; + use TgBotLib\Objects\BotCommandScope; + use TgBotLib\Objects\BotDescription; + use TgBotLib\Objects\BotShortDescription; + use TgBotLib\Objects\Chat; + use TgBotLib\Objects\ChatAdministratorRights; + use TgBotLib\Objects\ChatInviteLink; + use TgBotLib\Objects\ChatMember; + use TgBotLib\Objects\File; + use TgBotLib\Objects\ForumTopic; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultArticle; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultAudio; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultContact; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultDocument; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultGame; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultGif; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultLocation; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultMpeg4Gif; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultPhoto; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultVenue; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultVideo; + use TgBotLib\Objects\InlineQueryResult\InlineQueryResultVoice; + use TgBotLib\Objects\MenuButton; + use TgBotLib\Objects\Message; + use TgBotLib\Objects\Poll; + use TgBotLib\Objects\SentWebAppMessage; + use TgBotLib\Objects\Sticker; + use TgBotLib\Objects\Update; + use TgBotLib\Objects\User; + use TgBotLib\Objects\UserProfilePhotos; + use TgBotLib\Objects\WebhookInfo; class BotOld { diff --git a/src/TgBotLib/Interfaces/CommandInterface.php b/src/TgBotLib/Interfaces/CommandInterface.php index 7fb8207..617489e 100644 --- a/src/TgBotLib/Interfaces/CommandInterface.php +++ b/src/TgBotLib/Interfaces/CommandInterface.php @@ -3,7 +3,7 @@ namespace TgBotLib\Interfaces; use TgBotLib\BotOld; - use TgBotLib\Objects\Telegram\Update; + use TgBotLib\Objects\Update; interface CommandInterface { diff --git a/src/TgBotLib/Interfaces/EventInterface.php b/src/TgBotLib/Interfaces/EventInterface.php index 796df19..d5dd599 100644 --- a/src/TgBotLib/Interfaces/EventInterface.php +++ b/src/TgBotLib/Interfaces/EventInterface.php @@ -3,7 +3,7 @@ namespace TgBotLib\Interfaces; use TgBotLib\BotOld; - use TgBotLib\Objects\Telegram\Update; + use TgBotLib\Objects\Update; interface EventInterface { diff --git a/src/TgBotLib/Methods/GetMe.php b/src/TgBotLib/Methods/GetMe.php index 4535d61..2ec4158 100644 --- a/src/TgBotLib/Methods/GetMe.php +++ b/src/TgBotLib/Methods/GetMe.php @@ -5,7 +5,7 @@ namespace TgBotLib\Methods; use TgBotLib\Abstracts\Method; use TgBotLib\Bot; use TgBotLib\Enums\Methods; -use TgBotLib\Objects\Telegram\User; +use TgBotLib\Objects\User; class GetMe extends Method { diff --git a/src/TgBotLib/Methods/SendMessage.php b/src/TgBotLib/Methods/SendMessage.php index 11e7e8e..f9f0575 100644 --- a/src/TgBotLib/Methods/SendMessage.php +++ b/src/TgBotLib/Methods/SendMessage.php @@ -6,7 +6,7 @@ use InvalidArgumentException; use TgBotLib\Abstracts\Method; use TgBotLib\Bot; use TgBotLib\Enums\Methods; -use TgBotLib\Objects\Telegram\Message; +use TgBotLib\Objects\Message; class SendMessage extends Method { diff --git a/src/TgBotLib/Objects/Telegram/Animation.php b/src/TgBotLib/Objects/Animation.php similarity index 99% rename from src/TgBotLib/Objects/Telegram/Animation.php rename to src/TgBotLib/Objects/Animation.php index 6c00626..bc2c1a6 100644 --- a/src/TgBotLib/Objects/Telegram/Animation.php +++ b/src/TgBotLib/Objects/Animation.php @@ -2,7 +2,7 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram; + namespace TgBotLib\Objects; use TgBotLib\Interfaces\ObjectTypeInterface; diff --git a/src/TgBotLib/Objects/Telegram/Audio.php b/src/TgBotLib/Objects/Audio.php similarity index 99% rename from src/TgBotLib/Objects/Telegram/Audio.php rename to src/TgBotLib/Objects/Audio.php index 11a7437..ba98eae 100644 --- a/src/TgBotLib/Objects/Telegram/Audio.php +++ b/src/TgBotLib/Objects/Audio.php @@ -2,7 +2,7 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram; + namespace TgBotLib\Objects; use TgBotLib\Interfaces\ObjectTypeInterface; diff --git a/src/TgBotLib/Objects/Telegram/BackgroundFill.php b/src/TgBotLib/Objects/BackgroundFill.php similarity index 82% rename from src/TgBotLib/Objects/Telegram/BackgroundFill.php rename to src/TgBotLib/Objects/BackgroundFill.php index 10719fb..1148946 100644 --- a/src/TgBotLib/Objects/Telegram/BackgroundFill.php +++ b/src/TgBotLib/Objects/BackgroundFill.php @@ -1,13 +1,13 @@ input_message_content; } @@ -282,10 +282,10 @@ /** * Sets the input_message_content of the result. * - * @param InputMessageContent\InputContactMessageContent|InputMessageContent\InputInvoiceMessageContent|InputMessageContent\InputLocationMessageContent|InputMessageContent\InputTextMessageContent|InputMessageContent\InputVenueMessageContent $input_message_content + * @param \TgBotLib\Objects\InputMessageContent\InputContactMessageContent|\TgBotLib\Objects\InputMessageContent\InputInvoiceMessageContent|\TgBotLib\Objects\InputMessageContent\InputLocationMessageContent|\TgBotLib\Objects\InputMessageContent\InputTextMessageContent|\TgBotLib\Objects\InputMessageContent\InputVenueMessageContent $input_message_content * @return $this */ - public function setInputMessageContent(InputMessageContent\InputContactMessageContent|InputMessageContent\InputInvoiceMessageContent|InputMessageContent\InputLocationMessageContent|InputMessageContent\InputTextMessageContent|InputMessageContent\InputVenueMessageContent $input_message_content): InlineQueryResultVoice + public function setInputMessageContent(\TgBotLib\Objects\InputMessageContent\InputContactMessageContent|\TgBotLib\Objects\InputMessageContent\InputInvoiceMessageContent|\TgBotLib\Objects\InputMessageContent\InputLocationMessageContent|\TgBotLib\Objects\InputMessageContent\InputTextMessageContent|\TgBotLib\Objects\InputMessageContent\InputVenueMessageContent $input_message_content): InlineQueryResultVoice { $this->input_message_content = $input_message_content; return $this; diff --git a/src/TgBotLib/Objects/Telegram/InputMedia.php b/src/TgBotLib/Objects/InputMedia.php similarity index 99% rename from src/TgBotLib/Objects/Telegram/InputMedia.php rename to src/TgBotLib/Objects/InputMedia.php index 32dccba..7daa2f1 100644 --- a/src/TgBotLib/Objects/Telegram/InputMedia.php +++ b/src/TgBotLib/Objects/InputMedia.php @@ -2,7 +2,7 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram; + namespace TgBotLib\Objects; use TgBotLib\Interfaces\ObjectTypeInterface; diff --git a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaAnimation.php b/src/TgBotLib/Objects/InputMedia/InputMediaAnimation.php similarity index 98% rename from src/TgBotLib/Objects/Telegram/InputMedia/InputMediaAnimation.php rename to src/TgBotLib/Objects/InputMedia/InputMediaAnimation.php index 63ff160..2abfa72 100644 --- a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaAnimation.php +++ b/src/TgBotLib/Objects/InputMedia/InputMediaAnimation.php @@ -2,12 +2,12 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram\InputMedia; + namespace TgBotLib\Objects\InputMedia; use TgBotLib\Enums\Types\InputMediaType; use TgBotLib\Interfaces\ObjectTypeInterface; - use TgBotLib\Objects\Telegram\InputMedia; - use TgBotLib\Objects\Telegram\MessageEntity; + use TgBotLib\Objects\InputMedia; + use TgBotLib\Objects\MessageEntity; class InputMediaAnimation implements ObjectTypeInterface { diff --git a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaAudio.php b/src/TgBotLib/Objects/InputMedia/InputMediaAudio.php similarity index 97% rename from src/TgBotLib/Objects/Telegram/InputMedia/InputMediaAudio.php rename to src/TgBotLib/Objects/InputMedia/InputMediaAudio.php index ff4d4eb..fa40061 100644 --- a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaAudio.php +++ b/src/TgBotLib/Objects/InputMedia/InputMediaAudio.php @@ -2,11 +2,11 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram\InputMedia; + namespace TgBotLib\Objects\InputMedia; use TgBotLib\Interfaces\ObjectTypeInterface; - use TgBotLib\Objects\Telegram\InputMedia; - use TgBotLib\Objects\Telegram\MessageEntity; + use TgBotLib\Objects\InputMedia; + use TgBotLib\Objects\MessageEntity; class InputMediaAudio implements ObjectTypeInterface { diff --git a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaDocument.php b/src/TgBotLib/Objects/InputMedia/InputMediaDocument.php similarity index 97% rename from src/TgBotLib/Objects/Telegram/InputMedia/InputMediaDocument.php rename to src/TgBotLib/Objects/InputMedia/InputMediaDocument.php index 7e2cb21..f8e8b9c 100644 --- a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaDocument.php +++ b/src/TgBotLib/Objects/InputMedia/InputMediaDocument.php @@ -2,11 +2,11 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram\InputMedia; + namespace TgBotLib\Objects\InputMedia; use TgBotLib\Interfaces\ObjectTypeInterface; - use TgBotLib\Objects\Telegram\InputMedia; - use TgBotLib\Objects\Telegram\MessageEntity; + use TgBotLib\Objects\InputMedia; + use TgBotLib\Objects\MessageEntity; class InputMediaDocument implements ObjectTypeInterface { diff --git a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaPhoto.php b/src/TgBotLib/Objects/InputMedia/InputMediaPhoto.php similarity index 97% rename from src/TgBotLib/Objects/Telegram/InputMedia/InputMediaPhoto.php rename to src/TgBotLib/Objects/InputMedia/InputMediaPhoto.php index fc1fbef..1d649c8 100644 --- a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaPhoto.php +++ b/src/TgBotLib/Objects/InputMedia/InputMediaPhoto.php @@ -2,11 +2,11 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram\InputMedia; + namespace TgBotLib\Objects\InputMedia; use TgBotLib\Interfaces\ObjectTypeInterface; - use TgBotLib\Objects\Telegram\InputMedia; - use TgBotLib\Objects\Telegram\MessageEntity; + use TgBotLib\Objects\InputMedia; + use TgBotLib\Objects\MessageEntity; class InputMediaPhoto implements ObjectTypeInterface { diff --git a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaVideo.php b/src/TgBotLib/Objects/InputMedia/InputMediaVideo.php similarity index 98% rename from src/TgBotLib/Objects/Telegram/InputMedia/InputMediaVideo.php rename to src/TgBotLib/Objects/InputMedia/InputMediaVideo.php index 1db7950..b50a73d 100644 --- a/src/TgBotLib/Objects/Telegram/InputMedia/InputMediaVideo.php +++ b/src/TgBotLib/Objects/InputMedia/InputMediaVideo.php @@ -2,11 +2,11 @@ /** @noinspection PhpMissingFieldTypeInspection */ - namespace TgBotLib\Objects\Telegram\InputMedia; + namespace TgBotLib\Objects\InputMedia; use TgBotLib\Interfaces\ObjectTypeInterface; - use TgBotLib\Objects\Telegram\InputMedia; - use TgBotLib\Objects\Telegram\MessageEntity; + use TgBotLib\Objects\InputMedia; + use TgBotLib\Objects\MessageEntity; class InputMediaVideo implements ObjectTypeInterface { diff --git a/src/TgBotLib/Objects/Telegram/InputMessageContent.php b/src/TgBotLib/Objects/InputMessageContent.php similarity index 81% rename from src/TgBotLib/Objects/Telegram/InputMessageContent.php rename to src/TgBotLib/Objects/InputMessageContent.php index 533cc44..0e02bc5 100644 --- a/src/TgBotLib/Objects/Telegram/InputMessageContent.php +++ b/src/TgBotLib/Objects/InputMessageContent.php @@ -1,15 +1,15 @@