Dodana procedura asynchronicznej generacji iteratora oraz komentarz w

jaki sposob inaczej przerobic fora na asynchroniczny. Przydatne ze
wzgledu na to ze szukajka nadal blokuje heartbeat bota - co skutkuje
warningnami i wyjatkami
This commit is contained in:
2023-06-11 10:12:02 +02:00
committed by migatu
parent 579a3f2a52
commit 9f756b3092
+15
View File
@@ -579,7 +579,22 @@ async def get_file(ctx, source, link):
)
logger.error("Wrong link provided youtube: {}".format(link))
return "", None
# define an asynchronous generator
async def async_iterator_generator(range):
# normal loop
for i in range:
# yield the result
yield i
''' Alternatywna wersja przerobienia fora na asynchroniczny
# traverse the iterable of awaitables
for item in coros:
# await and get the result from the awaitable
result = await item
# report the results
print(result)
'''
async def wyszukaj(ctx, how_many=0):
# TODO: Potem dorobić wyszukiwania po kawałkach słów i sieć neuronową z możliwością wyrażenia opinii o dopasowaniu.