mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
move loop to func
This commit is contained in:
parent
5edfe83708
commit
44710e4c8c
1 changed files with 13 additions and 1 deletions
|
@ -840,7 +840,19 @@ class OtherCog(commands.Cog):
|
|||
engine.save_to_file(text, target_fn)
|
||||
engine.runAndWait()
|
||||
last_3_sizes = [-3, -2, -1]
|
||||
while not os.path.exists(target_fn) or not all(x == os.stat(target_fn).st_size for x in last_3_sizes):
|
||||
|
||||
def should_loop():
|
||||
if not os.path.exists(target_fn):
|
||||
return True
|
||||
|
||||
stat = os.stat(target_fn)
|
||||
for _result in last_3_sizes:
|
||||
if stat.st_size != _result:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
while should_loop():
|
||||
last_3_sizes.pop(-1)
|
||||
last_3_sizes.append(os.stat(target_fn).st_size)
|
||||
sleep(3)
|
||||
|
|
Loading…
Reference in a new issue