From 0c84b3cebdca42f789d31e135289b4100672b589 Mon Sep 17 00:00:00 2001 From: xenofem Date: Fri, 26 Jun 2020 18:51:22 -0400 Subject: [PATCH] send tts messages for final countdown --- waggle-dance.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/waggle-dance.py b/waggle-dance.py index 37b912f..c6878c5 100755 --- a/waggle-dance.py +++ b/waggle-dance.py @@ -27,6 +27,13 @@ async def delete_if_possible(channels): except: pass +async def countdown(channel): + await asyncio.sleep(20) + await channel.send('10', tts=True) + await asyncio.sleep(5) + await channel.send('5', tts=True) + await asyncio.sleep(5) + with open('config.json') as f: config = json.load(f) @@ -108,13 +115,13 @@ async def on_message(message): return continue - await message.channel.send("{} Welcome to pollination! You'll be randomly paired up, moved into separate voice channels, spend some time chatting, and then move to a new channel and meet somebody else. Each round will last 5 minutes, and there'll be {} rounds total. I'll announce when your time is nearly up so you can wrap up your conversations, and I'll automatically move you to a different voice channel at the start of each new round. **Feel free to leave at any time if you need to. You won't get moved into new voice channels if you disconnect from voice.** If you find yourself alone in a channel, the person you were paired with for that round may have left; just relax and take a break for 5 minutes. Have fun!".format(mention_all, len(schedule))) + await message.channel.send("{} Welcome to pollination! You'll be randomly paired up, moved into separate voice channels, spend some time chatting, and then move to a new channel and meet somebody else. Each round will last 5 minutes, and there'll be {} rounds total. I'll announce when your time is nearly up so you can wrap up your conversations, and I'll automatically move you to a different voice channel at the start of each new round. If you keep this text channel open, you'll get audible countdowns via text-to-speech at the end of each round. **Feel free to leave at any time if you need to. You won't get moved into new voice channels if you disconnect from voice.** If you find yourself alone in a channel, the person you were paired with for that round may have left; just relax and take a break for 5 minutes. Have fun!".format(mention_all, len(schedule))) for matching in schedule: announcement = 'Next round starting in 30 seconds:\n' announcement += '\n'.join('{0} and {1} in {2}'.format(a.mention, b.mention, c.name) for ((a, b), c) in zip(matching, pollination_channels)) await message.channel.send(announcement) - await asyncio.sleep(30) + await countdown(message.channel) for ((a, b), c) in zip(matching, pollination_channels): try: await a.move_to(c) @@ -131,7 +138,7 @@ async def on_message(message): await asyncio.sleep(30) await message.channel.send('Returning to main channel in 30 seconds {}'.format(mention_all)) - await asyncio.sleep(30) + await countdown(message.channel) for u in participants: try: await u.move_to(main_voice_channel)