Update bot token handling and refactor Bot class.
This commit is contained in:
parent
20735b36db
commit
3dd46c8d27
5 changed files with 44 additions and 2784 deletions
|
@ -1,3 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
require 'ncc';
|
require 'ncc';
|
||||||
|
|
||||||
|
$token_path = __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'token.txt';
|
||||||
|
|
||||||
|
if(!file_exists($token_path))
|
||||||
|
{
|
||||||
|
throw new Exception(sprintf('The token file "%s" does not exist.', $token_path));
|
||||||
|
}
|
||||||
|
|
||||||
|
define('BOT_TOKEN', trim(file_get_contents($token_path)));
|
||||||
|
|
||||||
import('net.nosial.tgbotlib');
|
import('net.nosial.tgbotlib');
|
||||||
|
|
2828
src/TgBotLib/Bot.php
2828
src/TgBotLib/Bot.php
File diff suppressed because it is too large
Load diff
|
@ -3,7 +3,7 @@
|
||||||
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
|
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
import('net.nosial.tamerlib');
|
import('net.nosial.tamerlib');
|
||||||
|
|
||||||
$bot = new TgBotLib\Bot('<BOT TOKEN>');
|
$bot = new TgBotLib\BotOld('<BOT TOKEN>');
|
||||||
\TamerLib\tm::initialize(\TamerLib\Enums\TamerMode::CLIENT);
|
\TamerLib\tm::initialize(\TamerLib\Enums\TamerMode::CLIENT);
|
||||||
\TamerLib\tm::createWorker(8, __DIR__ . DIRECTORY_SEPARATOR . 'worker.php');
|
\TamerLib\tm::createWorker(8, __DIR__ . DIRECTORY_SEPARATOR . 'worker.php');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
|
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
$bot = new TgBotLib\Bot('<BOT TOKEN>');
|
$bot = new TgBotLib\BotOld('<BOT TOKEN>');
|
||||||
|
|
||||||
$bot->setCommandHandler('start', new \commands\StartCommand());
|
$bot->setCommandHandler('start', new \commands\StartCommand());
|
||||||
$bot->setCommandHandler('hash', new \commands\HashCommand());
|
$bot->setCommandHandler('hash', new \commands\HashCommand());
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
|
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
import('net.nosial.tamerlib');
|
import('net.nosial.tamerlib');
|
||||||
|
|
||||||
$bot = new TgBotLib\Bot('<BOT TOKEN>');
|
$bot = new TgBotLib\BotOld('<BOT TOKEN>');
|
||||||
|
|
||||||
$bot->setCommandHandler('start', new \commands\StartCommand());
|
$bot->setCommandHandler('start', new \commands\StartCommand());
|
||||||
$bot->setCommandHandler('hash', new \commands\HashCommand());
|
$bot->setCommandHandler('hash', new \commands\HashCommand());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue