22 lines
471 B
PHP
22 lines
471 B
PHP
<?php
|
|
|
|
namespace App\Telegram\Middleware;
|
|
|
|
use App\Telegram\TelegramBotContext;
|
|
use SergiX44\Nutgram\Nutgram;
|
|
|
|
/** Blocks /transfer (and similar) on agent bots. */
|
|
class OfficialBotOnly
|
|
{
|
|
public function __invoke(Nutgram $bot, callable $next): mixed
|
|
{
|
|
if (! app(TelegramBotContext::class)->isOfficial()) {
|
|
$bot->sendMessage('⛔ /transfer 仅限官方系统群使用');
|
|
|
|
return null;
|
|
}
|
|
|
|
return $next($bot);
|
|
}
|
|
}
|