示例#1
0
文件: bots.py 项目: cramja/aiochat
 async def on_message(self, event):
     if event.client_id != self.client_id:
         await self._dispatch.submit(
             MessageEvent.of(self.client_id, event.message))
示例#2
0
文件: bots.py 项目: cramja/aiochat
 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'))
示例#3
0
文件: bots.py 项目: cramja/aiochat
 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)))
示例#4
0
文件: bots.py 项目: cramja/aiochat
 async def on_get_state(self, event):
     await self._dispatch.submit(
         MessageEvent.of(self.client_id, f'mode is "{self.mode}"'))
示例#5
0
文件: bots.py 项目: cramja/aiochat
 async def on_exit(self, event):
     await self._dispatch.submit(MessageEvent.of(self.client_id, 'exiting'))
     self.teardown()