telegram-bot-sdk / addon-manager
Addon Manager for Telegram Bot SDK
Installs: 6 521
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=8.1
- illuminate/support: ^10 || ^11
- thecodingmachine/discovery: ^1.2
Requires (Dev)
- pestphp/pest: ^2.0
- php-parallel-lint/php-parallel-lint: ^1.3
- rector/rector: ^0.15.24
This package is auto-updated.
Last update: 2024-11-09 23:38:28 UTC
README
Addon Manager to add, remove, manage and load addons into Telegram Bot SDK.
If you want to develop addons for Telegram Bot SDK, please make sure to require this package in your composer file.
Install
$ composer require telegram-bot-sdk/addon-manager
Usage
Create An Addon
<?php namespace Acme\Addons; use Telegram\Bot\Addon\Addon; use Telegram\Bot\Events\UpdateEvent; class AcmeAddon extends Addon { public function register() { $this->bot->onUpdate(function (UpdateEvent $event) { $bot = $event->bot; $update = $event->update; // Do something with the inbound update received. }); } }
Register Addon
Auto-Discovery
The Addon Manager supports auto-discovery which registers the addons automatically.
Simply create a discovery.json
file in your project root.
{ "telegram/addon-config": [ "config/acme.php" ], "telegram/addon": [ "Acme\\Addons\\AcmeAddon" ] }
Manually Register
use Acme\Addons\AcmeAddon; use Telegram\Bot\Addon\AddonManager; // Make sure to register before initializing bot manager. AddonManager::register(AcmeAddon::class);
Remove Addon
AddonManager::remove(AcmeAddon::class);
Get Addons
$addons = AddonManager::getAddons();
Auto-Discover & Register Addons
AddonManager::discover();
Are You Using Telegram Bot SDK?
If you're using Telegram Bot SDK build your Telegram Bots or have a project that's relevant to the SDK, We'd love to know and share it with the world.
Head over to Awesome Telegram Bots to share, discover, and learn more.
Contributing
Thank you for considering contributing to the project. Please read the contributing guide before creating an issue or sending in a pull request.
Code of Conduct
Please read our Code of Conduct before contributing or engaging in discussions.
Security
If you discover a security vulnerability within this project, please email Syed at syed at lukonet.com
. All security vulnerabilities will be promptly addressed. You may view our full security policy here.
Credits
License
This project is open-sourced software licensed under the BSD 3-Clause license.