mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-11-03 16:36:44 +00:00 
			
		
		
		
	🎨 change permission check from driver into adapter #46
This commit is contained in:
		@@ -11,7 +11,7 @@ from dataclasses import dataclass, field
 | 
			
		||||
 | 
			
		||||
from nonebot.config import Config
 | 
			
		||||
from nonebot.typing import Driver, Message, WebSocket
 | 
			
		||||
from nonebot.typing import Any, Dict, Union, Optional, Callable, Iterable, Awaitable
 | 
			
		||||
from nonebot.typing import Any, Dict, Union, Optional, NoReturn, Callable, Iterable, Awaitable
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BaseBot(abc.ABC):
 | 
			
		||||
@@ -55,6 +55,13 @@ class BaseBot(abc.ABC):
 | 
			
		||||
        """Adapter 类型"""
 | 
			
		||||
        raise NotImplementedError
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    @abc.abstractmethod
 | 
			
		||||
    async def check_permission(cls, driver: Driver, connection_type: str,
 | 
			
		||||
                               headers: dict,
 | 
			
		||||
                               body: Optional[dict]) -> Union[str, NoReturn]:
 | 
			
		||||
        raise NotImplementedError
 | 
			
		||||
 | 
			
		||||
    @abc.abstractmethod
 | 
			
		||||
    async def handle_message(self, message: dict):
 | 
			
		||||
        """
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user