From ff2ac1b58778d3b271bbf26c80238f616fd8a032 Mon Sep 17 00:00:00 2001 From: Myned Date: Thu, 19 Oct 2017 04:39:41 -0400 Subject: [PATCH] Misc testing and shit --- src/main/run.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/run.py b/src/main/run.py index cc8cfaa..34c2263 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -18,7 +18,7 @@ from utils import utils as u # log.basicConfig(level=log.INFO) -bot = commands.Bot(command_prefix=u.config['prefix'], description='Experimental booru bot') +bot = commands.Bot(command_prefix=u.config['prefix'], description='Experimental miscellaneous bot') # Send and print ready message to #testing and console after logon @@ -99,14 +99,33 @@ async def reaction_remove(r, u): print('Removed') bot.remove_listener(on_reaction_remove) +# d.opus.load_opus('opus') + + +async def wait(voice): + asyncio.sleep(5) + await voice.disconnect() + + +def after(voice, error): + coro = voice.disconnect() + future = asyncio.run_coroutine_threadsafe(coro, voice.loop) + future.result() + @bot.command(name=',test', hidden=True) @commands.is_owner() @checks.del_ctx() async def test(ctx): - test = await ctx.send('\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}') - await test.add_reaction('\N{THUMBS UP SIGN}') - await test.add_reaction('#\u20e3') + def check(react, user): + return reaction.emoji == '\N{THUMBS UP SIGN}' + # channel = bot.get_channel(int(cid)) + # voice = await channel.connect() + # voice.play(d.AudioSource, after=lambda: after(voice)) + test = await ctx.send('thumbs up!') + while True: + done, pending = await asyncio.wait([bot.wait_for('reaction_add', check=check), bot.wait_for('reaction_remove', check=check)], return_when=asyncio.FIRST_COMPLETED) + await ctx.send('well doneeee') # bot.add_listener(on_reaction_add) # bot.add_listener(on_reaction_remove)