From d362152c7791afefbc263a00b04cf683b172bd4a Mon Sep 17 00:00:00 2001 From: taizan-hokouto <55448286+taizan-hokuto@users.noreply.github.com> Date: Sun, 1 Nov 2020 19:29:09 +0900 Subject: [PATCH] Change module name --- pytchat/cli/__init__.py | 2 +- pytchat/cli/echo.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pytchat/cli/__init__.py b/pytchat/cli/__init__.py index 16f8a76..98c25ec 100644 --- a/pytchat/cli/__init__.py +++ b/pytchat/cli/__init__.py @@ -62,7 +62,7 @@ def main(): print("You can specify only one video ID.") return try: - SimpleEcho(Arguments().video_ids[0]).run() + Echo(Arguments().video_ids[0]).run() except InvalidVideoIdException as e: print("Invalid video id:", str(e)) except Exception as e: diff --git a/pytchat/cli/echo.py b/pytchat/cli/echo.py index 506a40f..95876ab 100644 --- a/pytchat/cli/echo.py +++ b/pytchat/cli/echo.py @@ -1,4 +1,5 @@ import pytchat +from ..exceptions import ChatDataFinished, NoContents from ..util.extract_video_id import extract_video_id @@ -12,6 +13,10 @@ class Echo: chatdata = livechat.get() for c in chatdata.sync_items(): print(f"{c.datetime} [{c.author.name}] {c.message} {c.amountString}") - - - + + try: + livechat.raise_for_status() + except (ChatDataFinished, NoContents): + print("Chat finished.") + except Exception as e: + print(type(e), str(e))