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
fba22125
Commit
fba22125
authored
Feb 11, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean Admin commands, removing all unnecessary or unused code.
parent
a35d2cec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
49 deletions
+12
-49
ChatsCommand.php
src/Admin/ChatsCommand.php
+6
-17
SendtoallCommand.php
src/Admin/SendtoallCommand.php
+5
-18
SendtochannelCommand.php
src/Admin/SendtochannelCommand.php
+1
-14
No files found.
src/Admin/ChatsCommand.php
View file @
fba22125
...
...
@@ -13,8 +13,6 @@ namespace Longman\TelegramBot\Commands;
use
Longman\TelegramBot\Command
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\Chat
;
use
Longman\TelegramBot\Entities\Update
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -50,13 +48,6 @@ class ChatsCommand extends Command
*/
protected
$version
=
'1.0.0'
;
/**
* If this command is enabled
*
* @var boolean
*/
protected
$enabled
=
true
;
/**
* If this command is public
*
...
...
@@ -81,12 +72,13 @@ class ChatsCommand extends Command
//Preparing message
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$data
=
[
'chat_id'
=>
$chat_id
,
'text'
=>
'Sorry no database connection, unable to execute "'
.
$this
->
name
.
'" command.'
,
];
$result
=
Request
::
sendMessage
(
$data
);
return
$result
->
isOk
();
return
Request
::
sendMessage
(
$data
)
->
isOk
();
}
/**
...
...
@@ -96,12 +88,9 @@ class ChatsCommand extends Command
*/
public
function
execute
()
{
$update
=
$this
->
getUpdate
();
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$message_id
=
$message
->
getMessageId
();
$text
=
$message
->
getText
(
true
);
$results
=
DB
::
selectChats
(
true
,
//Send to groups (group chat)
...
...
@@ -133,7 +122,7 @@ class ChatsCommand extends Command
}
}
if
((
$user_chats
+
$group_chats
+
$super_group_chats
)
==
0
)
{
if
((
$user_chats
+
$group_chats
+
$super_group_chats
)
==
=
0
)
{
$text
=
'No chats found..'
;
}
else
{
$text
.=
"
\n
"
.
'Private Chats: '
.
$user_chats
;
...
...
@@ -146,7 +135,7 @@ class ChatsCommand extends Command
'chat_id'
=>
$chat_id
,
'text'
=>
$text
,
];
$result
=
Request
::
sendMessage
(
$data
);
return
$result
->
isOk
();
return
Request
::
sendMessage
(
$data
)
->
isOk
();
}
}
src/Admin/SendtoallCommand.php
View file @
fba22125
...
...
@@ -11,9 +11,6 @@
namespace
Longman\TelegramBot\Commands
;
use
Longman\TelegramBot\Command
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\Update
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -49,13 +46,6 @@ class SendtoallCommand extends Command
*/
protected
$version
=
'1.2.0'
;
/**
* If this command is enabled
*
* @var boolean
*/
protected
$enabled
=
true
;
/**
* If this command is public
*
...
...
@@ -80,12 +70,13 @@ class SendtoallCommand extends Command
//Preparing message
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$data
=
[
'chat_id'
=>
$chat_id
,
'text'
=>
'Sorry no database connection, unable to execute "'
.
$this
->
name
.
'" command.'
,
];
$result
=
Request
::
sendMessage
(
$data
);
return
$result
->
isOk
();
return
Request
::
sendMessage
(
$data
)
->
isOk
();
}
/**
...
...
@@ -97,12 +88,9 @@ class SendtoallCommand extends Command
*/
public
function
execute
()
{
$update
=
$this
->
getUpdate
();
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$message_id
=
$message
->
getMessageId
();
$text
=
$message
->
getText
(
true
);
if
(
empty
(
$text
))
{
$text
=
'Write the message to send: /sendall <message>'
;
...
...
@@ -147,7 +135,7 @@ class SendtoallCommand extends Command
}
$text
.=
'Delivered: '
.
(
$tot
-
$fail
)
.
'/'
.
$tot
.
"
\n
"
;
}
if
(
$tot
==
0
)
{
if
(
$tot
==
=
0
)
{
$text
=
'No users or chats found..'
;
}
...
...
@@ -156,7 +144,6 @@ class SendtoallCommand extends Command
'text'
=>
$text
,
];
$result
=
Request
::
sendMessage
(
$data
);
return
$result
->
isOk
();
return
Request
::
sendMessage
(
$data
)
->
isOk
();
}
}
src/Admin/SendtochannelCommand.php
View file @
fba22125
...
...
@@ -11,9 +11,6 @@
namespace
Longman\TelegramBot\Commands
;
use
Longman\TelegramBot\Command
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\Update
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -49,13 +46,6 @@ class SendtochannelCommand extends Command
*/
protected
$version
=
'0.1.0'
;
/**
* If this command is enabled
*
* @var boolean
*/
protected
$enabled
=
true
;
/**
* If this command is public
*
...
...
@@ -79,11 +69,9 @@ class SendtochannelCommand extends Command
*/
public
function
execute
()
{
$update
=
$this
->
getUpdate
();
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$message_id
=
$message
->
getMessageId
();
$text
=
$message
->
getText
(
true
);
if
(
empty
(
$text
))
{
...
...
@@ -109,7 +97,6 @@ class SendtochannelCommand extends Command
'text'
=>
$text_back
,
];
$result
=
Request
::
sendMessage
(
$data
);
return
$result
->
isOk
();
return
Request
::
sendMessage
(
$data
)
->
isOk
();
}
}
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