send new message to current session
(my_name)
| 17 | |
| 18 | |
| 19 | async def refresh_msg(my_name): |
| 20 | """send new message to current session""" |
| 21 | global chat_msgs |
| 22 | last_idx = len(chat_msgs) |
| 23 | while True: |
| 24 | await asyncio.sleep(0.5) |
| 25 | for m in chat_msgs[last_idx:]: |
| 26 | if m[0] != my_name: # only refresh message that not sent by current user |
| 27 | put_markdown('`%s`: %s' % m, sanitize=True, scope='msg-box') |
| 28 | |
| 29 | # remove expired message |
| 30 | if len(chat_msgs) > MAX_MESSAGES_CNT: |
| 31 | chat_msgs = chat_msgs[len(chat_msgs) // 2:] |
| 32 | |
| 33 | last_idx = len(chat_msgs) |
| 34 | |
| 35 | |
| 36 | async def main(): |
no test coverage detected
searching dependent graphs…