Skip to content

Commit

Permalink
bootstrapping and some scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TiiFuchs committed Mar 20, 2022
1 parent 10e2e44 commit d95a73d
Show file tree
Hide file tree
Showing 11 changed files with 610 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
APP_URL=

TELEGRAM_BOT_TOKEN=
TELEGRAM_BOT_USERNAME=
TELEGRAM_BOT_API_SERVER=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor/
.idea
.env
logs/*
23 changes: 23 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

require 'vendor/autoload.php';

define('BASE_PATH', __DIR__);

$dotenv = \Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

function createTelegram() {
static $telegram;

if (! $telegram) {
$telegram = new \Longman\TelegramBot\Telegram(
env('TELEGRAM_BOT_TOKEN'),
env('TELEGRAM_BOT_USERNAME')
);

$telegram->addCommandsPath(__DIR__ . '/app/Telegram/Commands');
}

return $telegram;
}
12 changes: 11 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@
],
"minimum-stability": "dev",
"require": {
"longman/telegram-bot": "@dev"
"longman/telegram-bot": "@dev",
"vlucas/phpdotenv": "5.4.x-dev"
},
"autoload": {
"files": [
"helpers.php"
],
"psr-4": {
"Longman\\TelegramBot\\Commands\\": "app/Telegram/Commands",
"App\\": "app"
}
},
"repositories": [
{
Expand Down
Loading

0 comments on commit d95a73d

Please sign in to comment.