mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
wtf
This commit is contained in:
parent
dbf9bd0e02
commit
c5e45621f2
2 changed files with 18 additions and 4 deletions
|
@ -39,7 +39,7 @@ voice_queue = []
|
||||||
voice_playing = None
|
voice_playing = None
|
||||||
|
|
||||||
# Init the executor
|
# Init the executor
|
||||||
executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
|
executor = concurrent.futures.ThreadPoolExecutor(max_workers=3)
|
||||||
|
|
||||||
class Video:
|
class Video:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -289,9 +289,6 @@ async def on_message(message: discord.Message):
|
||||||
if voice_player is None:
|
if voice_player is None:
|
||||||
await client.send_message(message.channel, f"ℹ Non c'è nulla in riproduzione al momento.")
|
await client.send_message(message.channel, f"ℹ Non c'è nulla in riproduzione al momento.")
|
||||||
return
|
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())
|
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"):
|
elif message.content.startswith("!queue"):
|
||||||
if voice_player is None:
|
if voice_player is None:
|
||||||
|
|
17
test_executor.py
Normal file
17
test_executor.py
Normal 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())
|
Loading…
Reference in a new issue