async def on_message(self, event): if event.client_id != self.client_id: await self._dispatch.submit( MessageEvent.of(self.client_id, event.message))
async def on_start(self, event): async with self.pgp.acquire() as conn: await conn.execute('DELETE FROM message WHERE TRUE;') await self._dispatch.submit(MessageEvent.of(self.client_id, 'cleared'))
async def on_list_intent(self, event): async with self.pgp.acquire() as conn: records = [repr(r) for r in await IntentDataEntity.all()] await self._dispatch.submit( MessageEvent.of(self.client_id, "\n".join(records)))
async def on_get_state(self, event): await self._dispatch.submit( MessageEvent.of(self.client_id, f'mode is "{self.mode}"'))
async def on_exit(self, event): await self._dispatch.submit(MessageEvent.of(self.client_id, 'exiting')) self.teardown()