mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
修改变量 PluginsClass
的声明类型为 List[BasePlugins]
This commit is contained in:
parent
ff26e814d2
commit
e04aa8476c
@ -2,17 +2,18 @@ import os
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from os import path
|
from os import path
|
||||||
from typing import Callable, List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
from telegram.ext import Application
|
from telegram.ext import Application
|
||||||
|
|
||||||
from logger import Log
|
from logger import Log
|
||||||
|
from plugins.base import BasePlugins
|
||||||
|
|
||||||
PluginsClass: List[Callable] = []
|
PluginsClass: List[BasePlugins] = []
|
||||||
|
|
||||||
|
|
||||||
def listener_plugins_class():
|
def listener_plugins_class():
|
||||||
def decorator(func: Callable):
|
def decorator(func: BasePlugins):
|
||||||
PluginsClass.append(
|
PluginsClass.append(
|
||||||
func
|
func
|
||||||
)
|
)
|
||||||
@ -64,7 +65,7 @@ class PluginsManager:
|
|||||||
for pc in PluginsClass:
|
for pc in PluginsClass:
|
||||||
if callable(pc):
|
if callable(pc):
|
||||||
try:
|
try:
|
||||||
ist = pc(*args)
|
ist: BasePlugins = pc(*args)
|
||||||
handlers_list = ist.create_handlers(*args)
|
handlers_list = ist.create_handlers(*args)
|
||||||
for handler in handlers_list:
|
for handler in handlers_list:
|
||||||
application.add_handler(handler)
|
application.add_handler(handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user