Add --echo option to cli
This commit is contained in:
17
pytchat/cli/echo.py
Normal file
17
pytchat/cli/echo.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import pytchat
|
||||
from ..util.extract_video_id import extract_video_id
|
||||
|
||||
|
||||
class Echo:
|
||||
def __init__(self, video_id):
|
||||
self.video_id = extract_video_id(video_id)
|
||||
|
||||
def run(self):
|
||||
livechat = pytchat.create(self.video_id)
|
||||
while livechat.is_alive():
|
||||
chatdata = livechat.get()
|
||||
for c in chatdata.sync_items():
|
||||
print(f"{c.datetime} [{c.author.name}] {c.message} {c.amountString}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user