Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 4
0
Archivo: util.py Proyecto: 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()
Ejemplo n.º 5
0
    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()