예제 #1
0
    def __init__(
        self,
        config: Config = None,
        *,
        loop=None,
        cache=None,
        process_pool_executor=None,
        thread_pool_executor=None,
    ) -> None:
        if config is None:
            config = Config(
                **DEFAULT,
                TOKEN="asdf",
                CHANNELS={},
                USERS={},
            )

        try:
            self.loop = loop or asyncio.get_running_loop()
        except RuntimeError:
            pass

        self.call_queue: list[Call] = []
        self.api = SlackAPI(self)
        self.channels: list[PublicChannel] = []
        self.ims: list[DirectMessageChannel] = []
        self.groups: list[PrivateChannel] = []
        self.cache: Cache = cache
        self.users: list[User] = [
            User(id=UserID("U0"), name="system"),
        ]
        self.responses: dict[str, Callable] = {}
        self.config = config
        self.process_pool_executor = process_pool_executor
        self.thread_pool_executor = thread_pool_executor
예제 #2
0
    def __init__(
        self,
        config: Config = None,
        *,
        loop=None,
        cache=None,
        process_pool_executor=None,
        thread_pool_executor=None,
    ) -> None:
        if config is None:
            config = Config(**DEFAULT, TOKEN='asdf', CHANNELS={}, USERS={})

        Namespace._bot = self
        self.loop = loop or asyncio.get_event_loop()
        self.call_queue: list[Call] = []
        self.api = SlackAPI(self)
        self.channels: list[PublicChannel] = []
        self.ims: list[DirectMessageChannel] = []
        self.groups: list[PrivateChannel] = []
        self.cache: Cache = cache
        self.users: list[User] = [User(id='U0', team_id='T0', name='system')]
        self.responses: dict[str, Callable] = {}
        self.config = config
        self.process_pool_executor = process_pool_executor
        self.thread_pool_executor = thread_pool_executor
예제 #3
0
 def __init__(self, config: AttrDict = None) -> None:
     BotLinkedNamespace._bot = self
     self.call_queue: List[Call] = []
     self.api = SlackAPI(self)
     self.channels: List[PublicChannel] = []
     self.ims: List[DirectMessageChannel] = []
     self.groups: List[PrivateChannel] = []
     self.users: Dict[UserID, User] = {}
     self.responses: Dict[str, Callable] = {}
     self.config = config
예제 #4
0
파일: util.py 프로젝트: kyunooh/yui
 def __init__(self, config: AttrDict = None) -> None:
     BotLinkedNamespace._bot = self
     self.loop = asyncio.get_event_loop()
     self.call_queue: List[Call] = []
     self.api = SlackAPI(self)
     self.channels: List[PublicChannel] = []
     self.ims: List[DirectMessageChannel] = []
     self.groups: List[PrivateChannel] = []
     self.users: Dict[UserID, User] = {}
     self.responses: Dict[str, Callable] = {}
     self.config = config
     self.process_pool_executor = ProcessPoolExecutor()
     self.thread_pool_executor = ThreadPoolExecutor()
예제 #5
0
파일: util.py 프로젝트: u1-liquid/yui
    def __init__(self, config: Config = None) -> None:
        if config is None:
            config = Config(**DEFAULT, TOKEN='asdf', CHANNELS={}, USERS={})

        Namespace._bot = self
        self.loop = asyncio.get_event_loop()
        self.call_queue: List[Call] = []
        self.api = SlackAPI(self)
        self.channels: List[PublicChannel] = []
        self.ims: List[DirectMessageChannel] = []
        self.groups: List[PrivateChannel] = []
        self.mc = aiomcache.Client(
            host=config.CACHE['HOST'],
            port=config.CACHE['PORT'],
        )
        self.cache: CacheMock = CacheMock(self.mc, 'YUI_TEST_')
        self.users: List[User] = [User(id='U0', team_id='T0', name='system')]
        self.responses: Dict[str, Callable] = {}
        self.config = config
        self.process_pool_executor = ProcessPoolExecutor()
        self.thread_pool_executor = ThreadPoolExecutor()