forked from ArashAbedii/TeleBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartisan
39 lines (31 loc) · 941 Bytes
/
artisan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
#!/usr/bin/env php
include './vendor/autoload.php';
use Src\Bot;
use Src\CommandFactory\LongPolling;
use Src\CommandFactory\ModelMaker;
$event=$argv[1];
$moduleName=isset($argv[2]) ? $argv[2] : false;
if($event=='make:module'){
if(empty($moduleName)){
die('Enter module name : php artisan make:module moduleName');
}else{
file_put_contents("app/Modules/$moduleName.php",'<?php
namespace App\Modules;
class '.$moduleName.' {
public static function run(){
return new '.$moduleName.';
}
}');
echo "Your module created successfully\n";
}
}elseif($event=='set:webhook'){
print(Bot::setWebhook()."\n");
}elseif($event=='delete:webhook'){
print(Bot::deleteWebhook()."\n");
}elseif($event=='make:model'){
print(ModelMaker::create($moduleName));
}elseif($event=='run:bot' && $moduleName=='--long-polling'){
print("Bot is running ...");
print(LongPolling::run());
}