Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
39c5009f
Commit
39c5009f
authored
May 17, 2016
by
Jack'lul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make spacing fixes for better viewing and small code fixes
parent
1e86fb70
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
64 additions
and
61 deletions
+64
-61
SendtoallCommand.php
src/Commands/AdminCommands/SendtoallCommand.php
+1
-3
SendtochannelCommand.php
src/Commands/AdminCommands/SendtochannelCommand.php
+3
-3
Audio.php
src/Entities/Audio.php
+2
-3
Chat.php
src/Entities/Chat.php
+0
-7
ChosenInlineResult.php
src/Entities/ChosenInlineResult.php
+0
-2
Contact.php
src/Entities/Contact.php
+0
-2
Document.php
src/Entities/Document.php
+4
-6
Entity.php
src/Entities/Entity.php
+0
-2
File.php
src/Entities/File.php
+2
-4
InlineKeyboardButton.php
src/Entities/InlineKeyboardButton.php
+4
-5
InlineKeyboardMarkup.php
src/Entities/InlineKeyboardMarkup.php
+1
-1
InlineQuery.php
src/Entities/InlineQuery.php
+4
-2
InlineQueryResult.php
src/Entities/InlineQueryResult.php
+11
-0
InlineQueryResultArticle.php
src/Entities/InlineQueryResultArticle.php
+0
-1
InlineQueryResultGif.php
src/Entities/InlineQueryResultGif.php
+5
-2
InlineQueryResultMpeg4Gif.php
src/Entities/InlineQueryResultMpeg4Gif.php
+5
-2
InlineQueryResultPhoto.php
src/Entities/InlineQueryResultPhoto.php
+6
-2
InlineQueryResultVideo.php
src/Entities/InlineQueryResultVideo.php
+8
-1
InputContactMessageContent.php
src/Entities/InputContactMessageContent.php
+0
-2
InputLocationMessageContent.php
src/Entities/InputLocationMessageContent.php
+0
-2
InputTextMessageContent.php
src/Entities/InputTextMessageContent.php
+0
-2
InputVenueMessageContent.php
src/Entities/InputVenueMessageContent.php
+0
-2
Message.php
src/Entities/Message.php
+0
-1
MessageEntity.php
src/Entities/MessageEntity.php
+7
-3
ReplyKeyboardMarkup.php
src/Entities/ReplyKeyboardMarkup.php
+1
-1
No files found.
src/Commands/AdminCommands/SendtoallCommand.php
View file @
39c5009f
...
@@ -31,8 +31,6 @@ class SendtoallCommand extends AdminCommand
...
@@ -31,8 +31,6 @@ class SendtoallCommand extends AdminCommand
/**
/**
* Execute command
* Execute command
*
*
* @todo Don't use empty, as a string of '0' is regarded to be empty
*
* @return boolean
* @return boolean
*/
*/
public
function
execute
()
public
function
execute
()
...
@@ -42,7 +40,7 @@ class SendtoallCommand extends AdminCommand
...
@@ -42,7 +40,7 @@ class SendtoallCommand extends AdminCommand
$chat_id
=
$message
->
getChat
()
->
getId
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$text
=
$message
->
getText
(
true
);
$text
=
$message
->
getText
(
true
);
if
(
empty
(
$text
)
)
{
if
(
$text
===
''
)
{
$text
=
'Write the message to send: /sendtoall <message>'
;
$text
=
'Write the message to send: /sendtoall <message>'
;
}
else
{
}
else
{
$results
=
Request
::
sendToActiveChats
(
$results
=
Request
::
sendToActiveChats
(
...
...
src/Commands/AdminCommands/SendtochannelCommand.php
View file @
39c5009f
...
@@ -67,7 +67,7 @@ class SendtochannelCommand extends AdminCommand
...
@@ -67,7 +67,7 @@ class SendtochannelCommand extends AdminCommand
switch
(
$state
)
{
switch
(
$state
)
{
case
-
1
:
case
-
1
:
// getConfig has not been configured asking for channel to administer
// getConfig has not been configured asking for channel to administer
if
(
$type
!=
'Message'
||
empty
(
$text
)
)
{
if
(
$type
!=
'Message'
||
$text
===
''
)
{
$this
->
conversation
->
notes
[
'state'
]
=
-
1
;
$this
->
conversation
->
notes
[
'state'
]
=
-
1
;
$this
->
conversation
->
update
();
$this
->
conversation
->
update
();
...
@@ -116,7 +116,7 @@ class SendtochannelCommand extends AdminCommand
...
@@ -116,7 +116,7 @@ class SendtochannelCommand extends AdminCommand
// no break
// no break
case
1
:
case
1
:
insert
:
insert
:
if
(
$this
->
conversation
->
notes
[
'last_message_id'
]
==
$message
->
getMessageId
()
||
(
$type
==
'Message'
&&
empty
(
$text
)
))
{
if
(
$this
->
conversation
->
notes
[
'last_message_id'
]
==
$message
->
getMessageId
()
||
(
$type
==
'Message'
&&
$text
===
''
))
{
$this
->
conversation
->
notes
[
'state'
]
=
1
;
$this
->
conversation
->
notes
[
'state'
]
=
1
;
$this
->
conversation
->
update
();
$this
->
conversation
->
update
();
...
@@ -245,7 +245,7 @@ class SendtochannelCommand extends AdminCommand
...
@@ -245,7 +245,7 @@ class SendtochannelCommand extends AdminCommand
$data
=
[];
$data
=
[];
$data
[
'chat_id'
]
=
$chat_id
;
$data
[
'chat_id'
]
=
$chat_id
;
if
(
empty
(
$text
)
)
{
if
(
$text
===
''
)
{
$data
[
'text'
]
=
'Usage: /sendtochannel <text>'
;
$data
[
'text'
]
=
'Usage: /sendtochannel <text>'
;
}
else
{
}
else
{
$channels
=
(
array
)
$this
->
getConfig
(
'your_channel'
);
$channels
=
(
array
)
$this
->
getConfig
(
'your_channel'
);
...
...
src/Entities/Audio.php
View file @
39c5009f
...
@@ -21,10 +21,8 @@ class Audio extends Entity
...
@@ -21,10 +21,8 @@ class Audio extends Entity
protected
$mime_type
;
protected
$mime_type
;
protected
$file_size
;
protected
$file_size
;
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
file_id
=
isset
(
$data
[
'file_id'
])
?
$data
[
'file_id'
]
:
null
;
$this
->
file_id
=
isset
(
$data
[
'file_id'
])
?
$data
[
'file_id'
]
:
null
;
if
(
empty
(
$this
->
file_id
))
{
if
(
empty
(
$this
->
file_id
))
{
throw
new
TelegramException
(
'file_id is empty!'
);
throw
new
TelegramException
(
'file_id is empty!'
);
...
@@ -40,7 +38,6 @@ class Audio extends Entity
...
@@ -40,7 +38,6 @@ class Audio extends Entity
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
mime_type
=
isset
(
$data
[
'mime_type'
])
?
$data
[
'mime_type'
]
:
null
;
$this
->
mime_type
=
isset
(
$data
[
'mime_type'
])
?
$data
[
'mime_type'
]
:
null
;
$this
->
file_size
=
isset
(
$data
[
'file_size'
])
?
$data
[
'file_size'
]
:
null
;
$this
->
file_size
=
isset
(
$data
[
'file_size'
])
?
$data
[
'file_size'
]
:
null
;
}
}
public
function
getFileId
()
public
function
getFileId
()
...
@@ -57,10 +54,12 @@ class Audio extends Entity
...
@@ -57,10 +54,12 @@ class Audio extends Entity
{
{
return
$this
->
performer
;
return
$this
->
performer
;
}
}
public
function
getTitle
()
public
function
getTitle
()
{
{
return
$this
->
title
;
return
$this
->
title
;
}
}
public
function
getMimeType
()
public
function
getMimeType
()
{
{
return
$this
->
mime_type
;
return
$this
->
mime_type
;
...
...
src/Entities/Chat.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
Chat
extends
Entity
class
Chat
extends
Entity
{
{
protected
$id
;
protected
$id
;
protected
$type
;
protected
$type
;
protected
$title
;
protected
$title
;
...
@@ -81,37 +80,31 @@ class Chat extends Entity
...
@@ -81,37 +80,31 @@ class Chat extends Entity
public
function
getId
()
public
function
getId
()
{
{
return
$this
->
id
;
return
$this
->
id
;
}
}
public
function
getType
()
public
function
getType
()
{
{
return
$this
->
type
;
return
$this
->
type
;
}
}
public
function
getTitle
()
public
function
getTitle
()
{
{
return
$this
->
title
;
return
$this
->
title
;
}
}
public
function
getFirstName
()
public
function
getFirstName
()
{
{
return
$this
->
first_name
;
return
$this
->
first_name
;
}
}
public
function
getLastName
()
public
function
getLastName
()
{
{
return
$this
->
last_name
;
return
$this
->
last_name
;
}
}
public
function
getUsername
()
public
function
getUsername
()
{
{
return
$this
->
username
;
return
$this
->
username
;
}
}
...
...
src/Entities/ChosenInlineResult.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
ChosenInlineResult
extends
Entity
class
ChosenInlineResult
extends
Entity
{
{
protected
$result_id
;
protected
$result_id
;
protected
$from
;
protected
$from
;
protected
$location
;
protected
$location
;
...
@@ -23,7 +22,6 @@ class ChosenInlineResult extends Entity
...
@@ -23,7 +22,6 @@ class ChosenInlineResult extends Entity
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
result_id
=
isset
(
$data
[
'result_id'
])
?
$data
[
'result_id'
]
:
null
;
$this
->
result_id
=
isset
(
$data
[
'result_id'
])
?
$data
[
'result_id'
]
:
null
;
if
(
empty
(
$this
->
result_id
))
{
if
(
empty
(
$this
->
result_id
))
{
throw
new
TelegramException
(
'result_id is empty!'
);
throw
new
TelegramException
(
'result_id is empty!'
);
...
...
src/Entities/Contact.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
Contact
extends
Entity
class
Contact
extends
Entity
{
{
protected
$phone_number
;
protected
$phone_number
;
protected
$first_name
;
protected
$first_name
;
protected
$last_name
;
protected
$last_name
;
...
@@ -22,7 +21,6 @@ class Contact extends Entity
...
@@ -22,7 +21,6 @@ class Contact extends Entity
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
phone_number
=
isset
(
$data
[
'phone_number'
])
?
$data
[
'phone_number'
]
:
null
;
$this
->
phone_number
=
isset
(
$data
[
'phone_number'
])
?
$data
[
'phone_number'
]
:
null
;
if
(
empty
(
$this
->
phone_number
))
{
if
(
empty
(
$this
->
phone_number
))
{
throw
new
TelegramException
(
'phone_number is empty!'
);
throw
new
TelegramException
(
'phone_number is empty!'
);
...
...
src/Entities/Document.php
View file @
39c5009f
...
@@ -22,7 +22,6 @@ class Document extends Entity
...
@@ -22,7 +22,6 @@ class Document extends Entity
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
file_id
=
isset
(
$data
[
'file_id'
])
?
$data
[
'file_id'
]
:
null
;
$this
->
file_id
=
isset
(
$data
[
'file_id'
])
?
$data
[
'file_id'
]
:
null
;
if
(
empty
(
$this
->
file_id
))
{
if
(
empty
(
$this
->
file_id
))
{
throw
new
TelegramException
(
'file_id is empty!'
);
throw
new
TelegramException
(
'file_id is empty!'
);
...
@@ -36,7 +35,6 @@ class Document extends Entity
...
@@ -36,7 +35,6 @@ class Document extends Entity
$this
->
file_name
=
isset
(
$data
[
'file_name'
])
?
$data
[
'file_name'
]
:
null
;
$this
->
file_name
=
isset
(
$data
[
'file_name'
])
?
$data
[
'file_name'
]
:
null
;
$this
->
mime_type
=
isset
(
$data
[
'mime_type'
])
?
$data
[
'mime_type'
]
:
null
;
$this
->
mime_type
=
isset
(
$data
[
'mime_type'
])
?
$data
[
'mime_type'
]
:
null
;
$this
->
file_size
=
isset
(
$data
[
'file_size'
])
?
$data
[
'file_size'
]
:
null
;
$this
->
file_size
=
isset
(
$data
[
'file_size'
])
?
$data
[
'file_size'
]
:
null
;
}
}
public
function
getFileId
()
public
function
getFileId
()
...
@@ -46,21 +44,21 @@ class Document extends Entity
...
@@ -46,21 +44,21 @@ class Document extends Entity
public
function
getThumb
()
public
function
getThumb
()
{
{
return
$this
->
thumb
;
return
$this
->
thumb
;
}
}
public
function
getFileName
()
public
function
getFileName
()
{
{
return
$this
->
file_name
;
return
$this
->
file_name
;
}
}
public
function
getMimeType
()
public
function
getMimeType
()
{
{
return
$this
->
mime_type
;
return
$this
->
mime_type
;
}
}
public
function
getFileSize
()
public
function
getFileSize
()
{
{
return
$this
->
file_size
;
return
$this
->
file_size
;
}
}
}
}
src/Entities/Entity.php
View file @
39c5009f
...
@@ -14,10 +14,8 @@ class Entity
...
@@ -14,10 +14,8 @@ class Entity
{
{
protected
$bot_name
;
protected
$bot_name
;
public
function
getBotName
()
public
function
getBotName
()
{
{
return
$this
->
bot_name
;
return
$this
->
bot_name
;
}
}
...
...
src/Entities/File.php
View file @
39c5009f
...
@@ -20,7 +20,6 @@ class File extends Entity
...
@@ -20,7 +20,6 @@ class File extends Entity
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
file_id
=
isset
(
$data
[
'file_id'
])
?
$data
[
'file_id'
]
:
null
;
$this
->
file_id
=
isset
(
$data
[
'file_id'
])
?
$data
[
'file_id'
]
:
null
;
if
(
empty
(
$this
->
file_id
))
{
if
(
empty
(
$this
->
file_id
))
{
throw
new
TelegramException
(
'file_id is empty!'
);
throw
new
TelegramException
(
'file_id is empty!'
);
...
@@ -29,7 +28,6 @@ class File extends Entity
...
@@ -29,7 +28,6 @@ class File extends Entity
$this
->
file_size
=
isset
(
$data
[
'file_size'
])
?
$data
[
'file_size'
]
:
null
;
$this
->
file_size
=
isset
(
$data
[
'file_size'
])
?
$data
[
'file_size'
]
:
null
;
$this
->
file_path
=
isset
(
$data
[
'file_path'
])
?
$data
[
'file_path'
]
:
null
;
$this
->
file_path
=
isset
(
$data
[
'file_path'
])
?
$data
[
'file_path'
]
:
null
;
}
}
public
function
getFileId
()
public
function
getFileId
()
...
@@ -39,11 +37,11 @@ class File extends Entity
...
@@ -39,11 +37,11 @@ class File extends Entity
public
function
getFileSize
()
public
function
getFileSize
()
{
{
return
$this
->
file_size
;
return
$this
->
file_size
;
}
}
public
function
getFilePath
()
public
function
getFilePath
()
{
{
return
$this
->
file_path
;
return
$this
->
file_path
;
}
}
}
}
src/Entities/InlineKeyboardButton.php
View file @
39c5009f
...
@@ -19,6 +19,9 @@ class InlineKeyboardButton extends Entity
...
@@ -19,6 +19,9 @@ class InlineKeyboardButton extends Entity
protected
$callback_data
;
protected
$callback_data
;
protected
$switch_inline_query
;
protected
$switch_inline_query
;
/**
* @todo check if only one of 'url, callback_data, switch_inline_query' fields is set, documentation states that only one of these can be used
*/
public
function
__construct
(
$data
=
array
())
public
function
__construct
(
$data
=
array
())
{
{
$this
->
text
=
isset
(
$data
[
'text'
])
?
$data
[
'text'
]
:
null
;
$this
->
text
=
isset
(
$data
[
'text'
])
?
$data
[
'text'
]
:
null
;
...
@@ -30,12 +33,8 @@ class InlineKeyboardButton extends Entity
...
@@ -30,12 +33,8 @@ class InlineKeyboardButton extends Entity
$this
->
callback_data
=
isset
(
$data
[
'callback_data'
])
?
$data
[
'callback_data'
]
:
null
;
$this
->
callback_data
=
isset
(
$data
[
'callback_data'
])
?
$data
[
'callback_data'
]
:
null
;
$this
->
switch_inline_query
=
isset
(
$data
[
'switch_inline_query'
])
?
$data
[
'switch_inline_query'
]
:
null
;
$this
->
switch_inline_query
=
isset
(
$data
[
'switch_inline_query'
])
?
$data
[
'switch_inline_query'
]
:
null
;
if
(
empty
(
$this
->
url
)
&&
empty
(
$this
->
callback_data
)
&&
empty
(
$this
->
switch_inline_query
)
)
{
if
(
$this
->
url
===
''
&&
$this
->
callback_data
===
''
&&
$this
->
switch_inline_query
===
''
)
{
throw
new
TelegramException
(
'You must use at least one of these fields: url, callback_data, switch_inline_query!'
);
throw
new
TelegramException
(
'You must use at least one of these fields: url, callback_data, switch_inline_query!'
);
}
}
/*
* @todo check if only one of 'url, callback_data, switch_inline_query' fields is set, documentation states that only one of these can be used
*/
}
}
}
}
src/Entities/InlineKeyboardMarkup.php
View file @
39c5009f
...
@@ -16,7 +16,7 @@ class InlineKeyboardMarkup extends Entity
...
@@ -16,7 +16,7 @@ class InlineKeyboardMarkup extends Entity
{
{
protected
$inline_keyboard
;
protected
$inline_keyboard
;
/*
/*
*
* @todo check for InlineKeyboardButton elements
* @todo check for InlineKeyboardButton elements
*/
*/
public
function
__construct
(
$data
=
array
())
public
function
__construct
(
$data
=
array
())
...
...
src/Entities/InlineQuery.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
InlineQuery
extends
Entity
class
InlineQuery
extends
Entity
{
{
protected
$id
;
protected
$id
;
protected
$from
;
protected
$from
;
protected
$location
;
protected
$location
;
...
@@ -23,7 +22,6 @@ class InlineQuery extends Entity
...
@@ -23,7 +22,6 @@ class InlineQuery extends Entity
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
id
=
isset
(
$data
[
'id'
])
?
$data
[
'id'
]
:
null
;
$this
->
id
=
isset
(
$data
[
'id'
])
?
$data
[
'id'
]
:
null
;
if
(
empty
(
$this
->
id
))
{
if
(
empty
(
$this
->
id
))
{
throw
new
TelegramException
(
'id is empty!'
);
throw
new
TelegramException
(
'id is empty!'
);
...
@@ -48,18 +46,22 @@ class InlineQuery extends Entity
...
@@ -48,18 +46,22 @@ class InlineQuery extends Entity
{
{
return
$this
->
id
;
return
$this
->
id
;
}
}
public
function
getFrom
()
public
function
getFrom
()
{
{
return
$this
->
from
;
return
$this
->
from
;
}
}
public
function
getLocation
()
public
function
getLocation
()
{
{
return
$this
->
location
;
return
$this
->
location
;
}
}
public
function
getQuery
()
public
function
getQuery
()
{
{
return
$this
->
query
;
return
$this
->
query
;
}
}
public
function
getOffset
()
public
function
getOffset
()
{
{
return
$this
->
offset
;
return
$this
->
offset
;
...
...
src/Entities/InlineQueryResult.php
View file @
39c5009f
...
@@ -35,8 +35,19 @@ class InlineQueryResult extends Entity
...
@@ -35,8 +35,19 @@ class InlineQueryResult extends Entity
{
{
return
$this
->
type
;
return
$this
->
type
;
}
}
public
function
getId
()
public
function
getId
()
{
{
return
$this
->
id
;
return
$this
->
id
;
}
}
public
function
getInputMessageContent
()
{
return
$this
->
input_message_content
;
}
public
function
getReplyMarkup
()
{
return
$this
->
reply_markup
;
}
}
}
src/Entities/InlineQueryResultArticle.php
View file @
39c5009f
...
@@ -45,7 +45,6 @@ class InlineQueryResultArticle extends InlineQueryResult
...
@@ -45,7 +45,6 @@ class InlineQueryResultArticle extends InlineQueryResult
$this
->
thumb_url
=
isset
(
$data
[
'thumb_url'
])
?
$data
[
'thumb_url'
]
:
null
;
$this
->
thumb_url
=
isset
(
$data
[
'thumb_url'
])
?
$data
[
'thumb_url'
]
:
null
;
$this
->
thumb_width
=
isset
(
$data
[
'thumb_width'
])
?
$data
[
'thumb_width'
]
:
null
;
$this
->
thumb_width
=
isset
(
$data
[
'thumb_width'
])
?
$data
[
'thumb_width'
]
:
null
;
$this
->
thumb_height
=
isset
(
$data
[
'thumb_height'
])
?
$data
[
'thumb_height'
]
:
null
;
$this
->
thumb_height
=
isset
(
$data
[
'thumb_height'
])
?
$data
[
'thumb_height'
]
:
null
;
}
}
public
function
getTitle
()
public
function
getTitle
()
...
...
src/Entities/InlineQueryResultGif.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
InlineQueryResultGif
extends
InlineQueryResult
class
InlineQueryResultGif
extends
InlineQueryResult
{
{
protected
$gif_url
;
protected
$gif_url
;
protected
$gif_width
;
protected
$gif_width
;
protected
$gif_height
;
protected
$gif_height
;
...
@@ -43,29 +42,33 @@ class InlineQueryResultGif extends InlineQueryResult
...
@@ -43,29 +42,33 @@ class InlineQueryResultGif extends InlineQueryResult
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
caption
=
isset
(
$data
[
'caption'
])
?
$data
[
'caption'
]
:
null
;
$this
->
caption
=
isset
(
$data
[
'caption'
])
?
$data
[
'caption'
]
:
null
;
}
}
public
function
getGifUrl
()
public
function
getGifUrl
()
{
{
return
$this
->
gif_url
;
return
$this
->
gif_url
;
}
}
public
function
getGifWidth
()
public
function
getGifWidth
()
{
{
return
$this
->
gif_width
;
return
$this
->
gif_width
;
}
}
public
function
getGifHeight
()
public
function
getGifHeight
()
{
{
return
$this
->
gif_height
;
return
$this
->
gif_height
;
}
}
public
function
getThumbUrl
()
public
function
getThumbUrl
()
{
{
return
$this
->
thumb_url
;
return
$this
->
thumb_url
;
}
}
public
function
getTitle
()
public
function
getTitle
()
{
{
return
$this
->
title
;
return
$this
->
title
;
}
}
public
function
getCaption
()
public
function
getCaption
()
{
{
return
$this
->
caption
;
return
$this
->
caption
;
...
...
src/Entities/InlineQueryResultMpeg4Gif.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
InlineQueryResultMpeg4Gif
extends
InlineQueryResult
class
InlineQueryResultMpeg4Gif
extends
InlineQueryResult
{
{
protected
$mpeg4_url
;
protected
$mpeg4_url
;
protected
$mpeg4_width
;
protected
$mpeg4_width
;
protected
$mpeg4_height
;
protected
$mpeg4_height
;
...
@@ -43,29 +42,33 @@ class InlineQueryResultMpeg4Gif extends InlineQueryResult
...
@@ -43,29 +42,33 @@ class InlineQueryResultMpeg4Gif extends InlineQueryResult
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
caption
=
isset
(
$data
[
'caption'
])
?
$data
[
'caption'
]
:
null
;
$this
->
caption
=
isset
(
$data
[
'caption'
])
?
$data
[
'caption'
]
:
null
;
}
}
public
function
getMpeg4Url
()
public
function
getMpeg4Url
()
{
{
return
$this
->
mpeg4_url
;
return
$this
->
mpeg4_url
;
}
}
public
function
getMpeg4Width
()
public
function
getMpeg4Width
()
{
{
return
$this
->
mpeg4_width
;
return
$this
->
mpeg4_width
;
}
}
public
function
getMpeg4Height
()
public
function
getMpeg4Height
()
{
{
return
$this
->
mpeg4_height
;
return
$this
->
mpeg4_height
;
}
}
public
function
getThumbUrl
()
public
function
getThumbUrl
()
{
{
return
$this
->
thumb_url
;
return
$this
->
thumb_url
;
}
}
public
function
getTitle
()
public
function
getTitle
()
{
{
return
$this
->
title
;
return
$this
->
title
;
}
}
public
function
getCaption
()
public
function
getCaption
()
{
{
return
$this
->
caption
;
return
$this
->
caption
;
...
...
src/Entities/InlineQueryResultPhoto.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
InlineQueryResultPhoto
extends
InlineQueryResult
class
InlineQueryResultPhoto
extends
InlineQueryResult
{
{
protected
$photo_url
;
protected
$photo_url
;
protected
$photo_width
;
protected
$photo_width
;
protected
$photo_height
;
protected
$photo_height
;
...
@@ -45,33 +44,38 @@ class InlineQueryResultPhoto extends InlineQueryResult
...
@@ -45,33 +44,38 @@ class InlineQueryResultPhoto extends InlineQueryResult
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
$this
->
description
=
isset
(
$data
[
'description'
])
?
$data
[
'description'
]
:
null
;
$this
->
description
=
isset
(
$data
[
'description'
])
?
$data
[
'description'
]
:
null
;
$this
->
caption
=
isset
(
$data
[
'caption'
])
?
$data
[
'caption'
]
:
null
;
$this
->
caption
=
isset
(
$data
[
'caption'
])
?
$data
[
'caption'
]
:
null
;
}
}
public
function
getPhotoUrl
()
public
function
getPhotoUrl
()
{
{
return
$this
->
photo_url
;
return
$this
->
photo_url
;
}
}
public
function
getPhotoWidth
()
public
function
getPhotoWidth
()
{
{
return
$this
->
photo_width
;
return
$this
->
photo_width
;
}
}
public
function
getPhotoHeight
()
public
function
getPhotoHeight
()
{
{
return
$this
->
photo_height
;
return
$this
->
photo_height
;
}
}
public
function
getThumbUrl
()
public
function
getThumbUrl
()
{
{
return
$this
->
thumb_url
;
return
$this
->
thumb_url
;
}
}
public
function
getTitle
()
public
function
getTitle
()
{
{
return
$this
->
title
;
return
$this
->
title
;
}
}
public
function
getDescription
()
public
function
getDescription
()
{
{
return
$this
->
description
;
return
$this
->
description
;
}
}
public
function
getCaption
()
public
function
getCaption
()
{
{
return
$this
->
caption
;
return
$this
->
caption
;
...
...
src/Entities/InlineQueryResultVideo.php
View file @
39c5009f
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
...
@@ -14,7 +14,6 @@ use Longman\TelegramBot\Exception\TelegramException;
class
InlineQueryResultVideo
extends
InlineQueryResult
class
InlineQueryResultVideo
extends
InlineQueryResult
{
{
protected
$video_url
;
protected
$video_url
;
protected
$mime_type
;
protected
$mime_type
;
protected
$thumb_url
;
protected
$thumb_url
;
...
@@ -56,34 +55,42 @@ class InlineQueryResultVideo extends InlineQueryResult
...
@@ -56,34 +55,42 @@ class InlineQueryResultVideo extends InlineQueryResult
{
{
return
$this
->
video_url
;
return
$this
->
video_url
;
}
}
public
function
getMimeType
()
public
function
getMimeType
()
{
{
return
$this
->
mime_type
;
return
$this
->
mime_type
;
}
}
public
function
getThumbUrl
()
public
function
getThumbUrl
()
{
{
return
$this
->
thumb_url
;
return
$this
->
thumb_url
;
}
}
public
function
getTitle
()
public
function
getTitle
()
{
{
return
$this
->
title
;
return
$this
->
title
;
}
}
public
function
getCaption
()
public
function
getCaption
()
{
{
return
$this
->
caption
;
return
$this
->
caption
;
}
}
public
function
getVideoWidth
()
public
function
getVideoWidth
()
{
{
return
$this
->
video_width
;
return
$this
->
video_width
;
}
}
public
function
getVideoHeight
()
public
function
getVideoHeight
()
{
{
return
$this
->
video_height
;
return
$this
->
video_height
;
}
}
public
function
getVideoDuration
()
public
function
getVideoDuration
()
{
{
return
$this
->
video_duration
;
return
$this
->
video_duration
;
}
}
public
function
getDescription
()
public
function
getDescription
()
{
{
return
$this
->
description
;
return
$this
->
description
;
...
...
src/Entities/InputContactMessageContent.php
View file @
39c5009f
...
@@ -20,8 +20,6 @@ class InputContactMessageContent extends InputMessageContent
...
@@ -20,8 +20,6 @@ class InputContactMessageContent extends InputMessageContent
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
//parent::__construct($data);
$this
->
phone_number
isset
(
$data
[
'phone_number'
])
?
$data
[
'phone_number'
]
:
null
;
$this
->
phone_number
isset
(
$data
[
'phone_number'
])
?
$data
[
'phone_number'
]
:
null
;
if
(
empty
(
$this
->
phone_number
))
{
if
(
empty
(
$this
->
phone_number
))
{
throw
new
TelegramException
(
'phone_number is empty!'
);
throw
new
TelegramException
(
'phone_number is empty!'
);
...
...
src/Entities/InputLocationMessageContent.php
View file @
39c5009f
...
@@ -19,8 +19,6 @@ class InputLocationMessageContent extends InputMessageContent
...
@@ -19,8 +19,6 @@ class InputLocationMessageContent extends InputMessageContent
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
//parent::__construct($data);
$this
->
latitude
isset
(
$data
[
'latitude'
])
?
$data
[
'latitude'
]
:
null
;
$this
->
latitude
isset
(
$data
[
'latitude'
])
?
$data
[
'latitude'
]
:
null
;
if
(
empty
(
$this
->
latitude
))
{
if
(
empty
(
$this
->
latitude
))
{
throw
new
TelegramException
(
'latitude is empty!'
);
throw
new
TelegramException
(
'latitude is empty!'
);
...
...
src/Entities/InputTextMessageContent.php
View file @
39c5009f
...
@@ -20,8 +20,6 @@ class InputTextMessageContent extends InputMessageContent
...
@@ -20,8 +20,6 @@ class InputTextMessageContent extends InputMessageContent
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
//parent::__construct($data);
$this
->
message_text
isset
(
$data
[
'message_text'
])
?
$data
[
'message_text'
]
:
null
;
$this
->
message_text
isset
(
$data
[
'message_text'
])
?
$data
[
'message_text'
]
:
null
;
if
(
empty
(
$this
->
message_text
))
{
if
(
empty
(
$this
->
message_text
))
{
throw
new
TelegramException
(
'message_text is empty!'
);
throw
new
TelegramException
(
'message_text is empty!'
);
...
...
src/Entities/InputVenueMessageContent.php
View file @
39c5009f
...
@@ -22,8 +22,6 @@ class InputVenueMessageContent extends InputMessageContent
...
@@ -22,8 +22,6 @@ class InputVenueMessageContent extends InputMessageContent
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
//parent::__construct($data);
$this
->
latitude
isset
(
$data
[
'latitude'
])
?
$data
[
'latitude'
]
:
null
;
$this
->
latitude
isset
(
$data
[
'latitude'
])
?
$data
[
'latitude'
]
:
null
;
if
(
empty
(
$this
->
latitude
))
{
if
(
empty
(
$this
->
latitude
))
{
throw
new
TelegramException
(
'latitude is empty!'
);
throw
new
TelegramException
(
'latitude is empty!'
);
...
...
src/Entities/Message.php
View file @
39c5009f
...
@@ -122,7 +122,6 @@ class Message extends Entity
...
@@ -122,7 +122,6 @@ class Message extends Entity
$this
->
forward_from
=
isset
(
$data
[
'forward_from'
])
?
$data
[
'forward_from'
]
:
null
;
$this
->
forward_from
=
isset
(
$data
[
'forward_from'
])
?
$data
[
'forward_from'
]
:
null
;
if
(
!
empty
(
$this
->
forward_from
))
{
if
(
!
empty
(
$this
->
forward_from
))
{
$this
->
forward_from
=
new
User
(
$this
->
forward_from
);
$this
->
forward_from
=
new
User
(
$this
->
forward_from
);
}
}
$this
->
forward_from_chat
=
isset
(
$data
[
'forward_from_chat'
])
?
$data
[
'forward_from_chat'
]
:
null
;
$this
->
forward_from_chat
=
isset
(
$data
[
'forward_from_chat'
])
?
$data
[
'forward_from_chat'
]
:
null
;
...
...
src/Entities/MessageEntity.php
View file @
39c5009f
...
@@ -17,20 +17,24 @@ class MessageEntity extends Entity
...
@@ -17,20 +17,24 @@ class MessageEntity extends Entity
protected
$length
;
protected
$length
;
protected
$url
;
protected
$url
;
/**
* @todo check for value from this list: https://core.telegram.org/bots/api#messageentity
* @todo "empty($this->offset) && $this->offset != 0" - not an ideal solution?
*/
public
function
__construct
(
array
$data
)
public
function
__construct
(
array
$data
)
{
{
$this
->
type
=
isset
(
$data
[
'type'
])
?
$data
[
'type'
]
:
null
;
$this
->
type
=
isset
(
$data
[
'type'
])
?
$data
[
'type'
]
:
null
;
if
(
empty
(
$this
->
type
))
{
//
@todo check for value from this list: https://core.telegram.org/bots/api#messageentity
if
(
empty
(
$this
->
type
))
{
//
throw
new
TelegramException
(
'type is empty!'
);
throw
new
TelegramException
(
'type is empty!'
);
}
}
$this
->
offset
=
isset
(
$data
[
'offset'
])
?
$data
[
'offset'
]
:
null
;
$this
->
offset
=
isset
(
$data
[
'offset'
])
?
$data
[
'offset'
]
:
null
;
if
(
empty
(
$this
->
offset
)
&&
$this
->
offset
!=
0
)
{
//
@todo this is not an ideal solution?
if
(
empty
(
$this
->
offset
)
&&
$this
->
offset
!=
0
)
{
//
throw
new
TelegramException
(
'offset is empty!'
);
throw
new
TelegramException
(
'offset is empty!'
);
}
}
$this
->
length
=
isset
(
$data
[
'length'
])
?
$data
[
'length'
]
:
null
;
$this
->
length
=
isset
(
$data
[
'length'
])
?
$data
[
'length'
]
:
null
;
if
(
empty
(
$this
->
length
)
&&
$this
->
offset
!=
0
)
{
//
@todo this is not an ideal solution?
if
(
empty
(
$this
->
length
)
&&
$this
->
offset
!=
0
)
{
//
throw
new
TelegramException
(
'length is empty!'
);
throw
new
TelegramException
(
'length is empty!'
);
}
}
...
...
src/Entities/ReplyKeyboardMarkup.php
View file @
39c5009f
...
@@ -21,7 +21,7 @@ class ReplyKeyboardMarkup extends Entity
...
@@ -21,7 +21,7 @@ class ReplyKeyboardMarkup extends Entity
protected
$one_time_keyboard
;
protected
$one_time_keyboard
;
protected
$selective
;
protected
$selective
;
/*
/*
*
* @todo check for KeyboardButton elements
* @todo check for KeyboardButton elements
*/
*/
public
function
__construct
(
$data
=
array
())
public
function
__construct
(
$data
=
array
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment