modernized 01a
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
import time
|
import time
|
||||||
from typing import AsyncGenerator
|
from typing import AsyncGenerator
|
||||||
@@ -38,10 +39,7 @@ async def main(room_url):
|
|||||||
print(f"participant joined: {participant['info']['userName']}")
|
print(f"participant joined: {participant['info']['userName']}")
|
||||||
if participant["info"]["isLocal"]:
|
if participant["info"]["isLocal"]:
|
||||||
return
|
return
|
||||||
audio_generator: AsyncGenerator[bytes, None] = tts.run_tts(f"Hello there, {participant['info']['userName']}!")
|
await tts.say(f"Hello there, {participant['info']['userName']}!", transport.send_queue)
|
||||||
|
|
||||||
async for audio in audio_generator:
|
|
||||||
transport.output_queue.put(QueueFrame(FrameType.AUDIO, audio))
|
|
||||||
|
|
||||||
print("setting up call state handler")
|
print("setting up call state handler")
|
||||||
@transport.event_handler("on_call_state_updated")
|
@transport.event_handler("on_call_state_updated")
|
||||||
@@ -52,4 +50,10 @@ async def main(room_url):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main("https://chad-hq.daily.co/howdy"))
|
parser = argparse.ArgumentParser(description="Simple Daily Bot Sample")
|
||||||
|
parser.add_argument(
|
||||||
|
"-u", "--url", type=str, required=True, help="URL of the Daily room to join"
|
||||||
|
)
|
||||||
|
|
||||||
|
args, unknown = parser.parse_known_args()
|
||||||
|
asyncio.run(main(args.url))
|
||||||
|
|||||||
Reference in New Issue
Block a user