forked from dexif/telegram
-
Notifications
You must be signed in to change notification settings - Fork 3
/
extend.php
executable file
·32 lines (28 loc) · 1.34 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace Nodeloc\Telegram;
use Flarum\Api\Serializer\UserSerializer;
use Flarum\Extend;
use Nodeloc\Telegram\Controllers\TelegramAuthController;
use Nodeloc\Telegram\Driver\TelegramNotificationDriver;
use Nodeloc\Telegram\Listeners\AddUserAttributes;
use Nodeloc\Telegram\Provider\TelegramNotificationServiceProvider;
return [
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less'),
(new Extend\Locales(__DIR__ . '/resources/locale')),
(new Extend\Event)
->subscribe(Driver\TelegramNotificationDriver::class)
->subscribe(Listeners\InjectSettings::class),
(new Extend\ApiSerializer(UserSerializer::class))->attributes(AddUserAttributes::class),
(new Extend\Notification())
->driver('telegram', TelegramNotificationDriver::class),
(new Extend\Settings)
->serializeToForum('nodeloc-telegram.botUsername', 'nodeloc-telegram.botUsername', )
->serializeToForum('nodeloc-telegram.botToken', 'nodeloc-telegram.botToken', )
->serializeToForum('nodeloc-telegram.enableNotifications', 'nodeloc-telegram.enableNotifications', 'boolval'),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Routes('forum'))
->get('/auth/telegram', 'auth.telegram', TelegramAuthController::class),
];