1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00
This commit is contained in:
Steffo 2018-01-15 18:25:12 +01:00
parent dbf9bd0e02
commit c5e45621f2
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D
2 changed files with 18 additions and 4 deletions

View file

@ -39,7 +39,7 @@ voice_queue = []
voice_playing = None
# Init the executor
executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
executor = concurrent.futures.ThreadPoolExecutor(max_workers=3)
class Video:
def __init__(self):
@ -289,9 +289,6 @@ async def on_message(message: discord.Message):
if voice_player is None:
await client.send_message(message.channel, f" Non c'è nulla in riproduzione al momento.")
return
voice_queue = []
voice_player.stop()
voice_player = None
await client.send_message(message.channel, f" Ora in riproduzione in <#{voice_client.channel.id}>:", embed=voice_playing.create_embed())
elif message.content.startswith("!queue"):
if voice_player is None:

17
test_executor.py Normal file
View file

@ -0,0 +1,17 @@
import asyncio
import functools
import concurrent.futures
loop = asyncio.get_event_loop()
executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
async def call_me():
await loop.run_in_executor(executor, functools.partial(print, "ciao"))
return
async def spam_calls():
while True:
asyncio.ensure_future(call_me())
await asyncio.sleep(1)
loop.run_until_complete(spam_calls())