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.
$ composer require telegram-bot-sdk/addon-manager
<?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.
});
}
}
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"
]
}
use Acme\Addons\AcmeAddon;
use Telegram\Bot\Addon\AddonManager;
// Make sure to register before initializing bot manager.
AddonManager::register(AcmeAddon::class);
AddonManager::remove(AcmeAddon::class);
$addons = AddonManager::getAddons();
AddonManager::discover();
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.
Thank you for considering contributing to the project. Please read the contributing guide before creating an issue or sending in a pull request.
Please read our Code of Conduct before contributing or engaging in discussions.
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.
This project is open-sourced software licensed under the BSD 3-Clause license.