11import asyncio
2- from loguru import logger
32
43from fastapi import APIRouter
4+ from loguru import logger
55
6- from lnbits . db import Database
7- from lnbits . helpers import template_renderer
8- from lnbits . tasks import create_permanent_unique_task
9-
10- db = Database ( "ext_copilot" )
6+ from . crud import db
7+ from . tasks import wait_for_paid_invoices
8+ from . views import copilot_generic_router
9+ from . views_api import copilot_api_router
10+ from . views_lnurl import copilot_lnurl_router
1111
1212copilot_static_files = [
1313 {
1616 }
1717]
1818copilot_ext : APIRouter = APIRouter (prefix = "/copilot" , tags = ["copilot" ])
19-
20-
21- def copilot_renderer ():
22- return template_renderer (["copilot/templates" ])
23-
24-
25- from .lnurl import * # noqa
26- from .tasks import wait_for_paid_invoices
27- from .views import * # noqa
28- from .views_api import * # noqa
19+ copilot_ext .include_router (copilot_generic_router )
20+ copilot_ext .include_router (copilot_api_router )
21+ copilot_ext .include_router (copilot_lnurl_router )
2922
3023scheduled_tasks : list [asyncio .Task ] = []
3124
@@ -39,5 +32,10 @@ def copilot_stop():
3932
4033
4134def copilot_start ():
35+ from lnbits .tasks import create_permanent_unique_task
36+
4237 task = create_permanent_unique_task ("ext_copilot" , wait_for_paid_invoices )
4338 scheduled_tasks .append (task )
39+
40+
41+ __all__ = ["copilot_ext" , "copilot_static_files" , "copilot_start" , "copilot_stop" , "db" ]
0 commit comments