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
0294f6ed
Commit
0294f6ed
authored
Jan 24, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Readme
parent
970ec947
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
52 deletions
+26
-52
README.md
README.md
+21
-7
DB.php
src/DB.php
+2
-2
InlineQueryResultArticle.php
src/Entities/InlineQueryResultArticle.php
+2
-42
Telegram.php
src/Telegram.php
+1
-1
No files found.
README.md
View file @
0294f6ed
...
...
@@ -21,11 +21,12 @@ Bot aims to provide a platform where one could simply write a plugin
and have interactions in a matter of minutes.
The Bot can:
-
retrive update with webhook and getUpdate methods.
-
supports all types and methods according to Telegram API (20
15 November
).
-
supports all types and methods according to Telegram API (20
January 2016
).
-
supports supergroups.
-
handle commands in chat with other bots.
-
manage Channel from the bot admin interface
-
Starting support for
**inline bots**
(under developing, checkout the InlinequeryCommand
**new!**
)
-
Full support for
**inline bots**
(
**new!**
)
-
Messages, InlineQuery and ChosenInlineQuery are stored in the Database (
**new!**
)
## Instructions
### Create your first bot
...
...
@@ -208,10 +209,13 @@ then run
./getUpdateCLI.php
```
### Types
All types implemented according to Telegram API (2015 November).
All types implemented according to Telegram API (20 January 2016).
#### Inline Query
Full support for inline query according to Telegram API (20 January 2016).
### Methods
All methods implemented according to Telegram API (20
15 November
).
All methods implemented according to Telegram API (20
January 2016
).
####Send Message
Message longer than 4096 characters are splitted in more message.
...
...
@@ -282,7 +286,7 @@ You can set a custom prefix to all the tables while you are enabling Mysql:
$telegram
->
enableMySQL
(
$credentials
,
$BOT_NAME
.
'_'
);
```
Consider to use the utf8mb4 branch if you find some special characters problems.
You can also store inline query and chosen inline query in the database.
### Channels Support
All methods implemented can be used to manage channels.
(
**new!**
) With admin interface you can manage your channel directly with your bot private chat.
...
...
@@ -298,6 +302,9 @@ It can execute command triggering a chat event. Here's the list:
-
Group chat created (
**GroupchatcreatedCommand.php**
)
-
Super group chat created (
**SupergroupchatcreatedCommand.php**
)
-
Channel chat created (
**ChannelchatcreatedCommand.php**
)
-
Inline query (
**InlinequeryCommand.php**
)
-
Chosen inline result (
**ChoseninlineresultCommand.php**
)
**GenericCommand.php**
let you handle commands that don't exist or to
use commands as a variable:
...
...
@@ -337,7 +344,7 @@ Telegram user id can be retrieved with the command **/whoami**.
Admin commands are stored in
*src/Admin/*
folder.
To know all the commands avaiable type
**/help**
.
#### Channel Administration
(NEW!)
#### Channel Administration
To enable this feature follow those steps:
-
Add your bot as channel administrator, this can be done with any telegram client.
-
Enable admin interface for your user as explained in the admin section above.
...
...
@@ -365,7 +372,7 @@ $telegram->setLogRequests(true);
$telegram
->
setLogPath
(
$BOT_NAME
.
'.log'
);
```
(New!)
Set verbosity to 3, to log also curl requests and responses from the bot to Telegram:
Set verbosity to 3, to log also curl requests and responses from the bot to Telegram:
```
php
$telegram
->
setLogRequests
(
true
);
...
...
@@ -377,6 +384,13 @@ $telegram->setLogVerbosity(3);
This code is available on
[
Github
](
https://github.com/akalongman/php-telegram-bot
)
. Pull requests are welcome.
##Documentation
Take a look at the repo
[
Wiki
](
https://github.com/akalongman/php-telegram-bot/wiki
)
for further information and tutorial!
Feel free to improve!
##Project with this library
Here's a list of projects that feats this library, feel free to add yours!
-
[
Super-Dice-Roll
](
https://github.com/RafaelDelboni/Super-Dice-Roll
)
[
@superdiceroll_bot
]
(https://telegram.me/superdiceroll_bot)
## Troubleshooting
...
...
src/DB.php
View file @
0294f6ed
...
...
@@ -538,7 +538,7 @@ class DB
$video
=
$message
->
getVideo
();
$voice
=
$message
->
getVoice
();
$caption
=
$message
->
getCaption
();
$conta
nc
=
$message
->
getContact
();
$conta
ct
=
$message
->
getContact
();
$location
=
$message
->
getLocation
();
$new_chat_title
=
$message
->
getNewChatTitle
();
$delete_chat_photo
=
$message
->
getDeleteChatPhoto
();
...
...
@@ -574,7 +574,7 @@ class DB
$sth
->
bindParam
(
':video'
,
$video
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':voice'
,
$voice
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':caption'
,
$caption
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':contact'
,
$conta
n
ct
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':contact'
,
$contact
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':location'
,
$location
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':new_chat_participant'
,
$new_chat_paticipant
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':left_chat_participant'
,
$left_chat_paticipant
,
\PDO
::
PARAM_INT
);
...
...
src/Entities/InlineQueryResultArticle.php
View file @
0294f6ed
...
...
@@ -12,14 +12,9 @@ namespace Longman\TelegramBot\Entities;
use
Longman\TelegramBot\Exception\TelegramException
;
class
InlineQueryResultArticle
extends
Entity
class
InlineQueryResultArticle
extends
InlineQueryResult
{
protected
$type
;
protected
$id
;
protected
$title
;
protected
$message_text
;
protected
$parse_mode
;
protected
$disable_web_page_preview
;
protected
$url
;
protected
$hide_url
;
protected
$description
;
...
...
@@ -29,26 +24,15 @@ class InlineQueryResultArticle extends Entity
public
function
__construct
(
array
$data
)
{
parent
::
__construct
(
$data
);
$this
->
type
=
'article'
;
$this
->
id
=
isset
(
$data
[
'id'
])
?
$data
[
'id'
]
:
null
;
if
(
empty
(
$this
->
id
))
{
throw
new
TelegramException
(
'id is empty!'
);
}
$this
->
title
=
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
if
(
empty
(
$this
->
title
))
{
throw
new
TelegramException
(
'title is empty!'
);
}
$this
->
message_text
=
isset
(
$data
[
'message_text'
])
?
$data
[
'message_text'
]
:
null
;
if
(
empty
(
$this
->
message_text
))
{
throw
new
TelegramException
(
'message_text is empty!'
);
}
$this
->
parse_mode
=
isset
(
$data
[
'parse_mode'
])
?
$data
[
'parse_mode'
]
:
null
;
$this
->
disable_web_page_preview
=
isset
(
$data
[
'disable_webpage_preview'
])
?
$data
[
'disable_webpage_preview'
]
:
null
;
$this
->
url
=
isset
(
$data
[
'url'
])
?
$data
[
'url'
]
:
null
;
$this
->
hide_url
=
isset
(
$data
[
'hide_url'
])
?
$data
[
'hide_url'
]
:
null
;
$this
->
description
=
isset
(
$data
[
'description'
])
?
$data
[
'description'
]
:
null
;
...
...
@@ -58,35 +42,11 @@ class InlineQueryResultArticle extends Entity
}
public
function
getType
()
{
return
$this
->
type
;
}
public
function
getId
()
{
return
$this
->
id
;
}
public
function
getTitle
()
{
return
$this
->
title
;
}
public
function
getMessageText
()
{
return
$this
->
message_text
;
}
public
function
getParseMode
()
{
return
$this
->
parse_mode
;
}
public
function
getDisableWebPagePreview
()
{
return
$this
->
disable_web_page_preview
;
}
public
function
getUrl
()
{
return
$this
->
url
;
...
...
src/Telegram.php
View file @
0294f6ed
...
...
@@ -29,7 +29,7 @@ class Telegram
*
* @var string
*/
protected
$version
=
'0.2
6
.0'
;
protected
$version
=
'0.2
7
.0'
;
/**
* Telegram API key
...
...
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