Skip to content

Commit ea75e5e

Browse files
author
Андрей Гостев
committed
Add recipe for andrew-gos/telegram-bot-bundle
https://packagist.org/packages/andrew-gos/telegram-bot-bundle
1 parent 6d92a43 commit ea75e5e

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# -----------------------------------------------------------------------------
2+
# AndrewGos Telegram Bot Bundle - Default Configuration
3+
# -----------------------------------------------------------------------------
4+
# This file was generated by the AndrewGos Telegram Bot Bundle recipe.
5+
# It provides a solid foundation for your first Telegram bot.
6+
#
7+
# ❗️ YOUR NEXT STEPS:
8+
# 1. Set your bot's token in the .env file:
9+
# TELEGRAM_BOT_TOKEN="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
10+
#
11+
# 2. Create the handler and checker classes referenced below, for example:
12+
# src/Telegram/Handler/StartHandler.php
13+
# src/Telegram/Checker/CommandChecker.php
14+
# src/Telegram/Handler/DefaultMessageHandler.php
15+
# -----------------------------------------------------------------------------
16+
17+
andrew_gos_telegram_bot:
18+
bots:
19+
# 🤖 This is the unique name for your bot.
20+
# You'll use this name in console commands, e.g., `php bin/console andrew-gos:telegram-bot:listen default_bot`
21+
# default_bot:
22+
# 🏭 The factory defines how the Telegram API client is created.
23+
# factory:
24+
# 'getUpdates' is a shortcut for the long-polling factory. It's perfect for
25+
# getting started quickly with the `listen` command.
26+
# For production, you will likely switch to webhooks using the 'default' factory.
27+
# method: 'getUpdates'
28+
# arguments:
29+
# ✅ Best Practice: Never hardcode secrets!
30+
# This reads the token from your .env file.
31+
# $token: '%env(string:TELEGRAM_BOT_TOKEN)%'
32+
33+
# 🔌 Plugins are services that run on EVERY update before handlers.
34+
# They are great for logging, analytics, or session management.
35+
# Uncomment this section to enable a request logger.
36+
# plugins:
37+
# - class: App\Telegram\Plugin\RequestLoggerPlugin
38+
# arguments:
39+
# # This injects the default Symfony logger for the 'telegram' channel.
40+
# $logger: '@monolog.logger.telegram'
41+
42+
# 🔄 Handlers contain the core logic of your bot.
43+
# They are checked in order of priority (higher numbers first).
44+
# The first handler whose 'checker' passes will be executed.
45+
# handlers:
46+
# Handler for the '/start' command. It has a high priority.
47+
# -
48+
# The checker decides if the handler should run for the current update.
49+
# checker:
50+
# class: App\Telegram\Checker\CommandChecker
51+
# arguments:
52+
# $command: '/start'
53+
54+
# The handler contains the actual logic to execute.
55+
# handler: App.Telegram.Handler.StartHandler
56+
57+
# Middlewares run after the checker but before the handler.
58+
# Useful for authentication, rate limiting, etc.
59+
# middlewares:
60+
# - App\Telegram\Middleware\UserRateLimiterMiddleware
61+
62+
# Higher priority means this handler is checked before others.
63+
# priority: 10
64+
65+
# A fallback handler for any message not caught by the handlers above.
66+
# When a 'checker' is not specified, it defaults to `AnyChecker`,
67+
# -
68+
# which always passes. This makes it a perfect "catch-all".
69+
# handler: App\Telegram\Handler\DefaultMessageHandler
70+
71+
# A negative priority ensures this runs last.
72+
# priority: -10
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"bundles": {
3+
"AndrewGos\\TelegramBotBundle\\AndrewGosTelegramBotBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"config/": "%CONFIG_DIR%/"
7+
}
8+
}

0 commit comments

Comments
 (0)