fixed error in retreiving litterbox link
This commit is contained in:
parent
d53803370a
commit
3fc4c0475d
2 changed files with 12 additions and 3 deletions
10
cogs/ytdl.py
10
cogs/ytdl.py
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands, tasks
|
||||||
from cogs.base_cog.bot_base_cog import BotBaseCog
|
from cogs.base_cog.bot_base_cog import BotBaseCog
|
||||||
|
|
||||||
class YoutubeDL(BotBaseCog):
|
class YoutubeDL(BotBaseCog):
|
||||||
|
|
@ -23,5 +23,13 @@ class YoutubeDL(BotBaseCog):
|
||||||
except:
|
except:
|
||||||
await ctx.send("Usage: !youtubedl <url> <video|audio>")
|
await ctx.send("Usage: !youtubedl <url> <video|audio>")
|
||||||
|
|
||||||
|
#create a task
|
||||||
|
@tasks.loop(seconds=10)
|
||||||
|
async def check_for_downloads(self):
|
||||||
|
for file in os.listdir("data/ytdl"):
|
||||||
|
if file.endswith(".txt"):
|
||||||
|
await self.bot.get_channel(544408659174883328).send(f"{file[:-4]}")
|
||||||
|
os.remove(f"data/ytdl/{file}")
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
await bot.add_cog(YoutubeDL(bot))
|
await bot.add_cog(YoutubeDL(bot))
|
||||||
|
|
@ -45,10 +45,11 @@ def main():
|
||||||
zip_file = zip_all_files()
|
zip_file = zip_all_files()
|
||||||
output_url = upload_to_litterbox(zip_file)
|
output_url = upload_to_litterbox(zip_file)
|
||||||
print(output_url)
|
print(output_url)
|
||||||
return output_url
|
with open(f"data/ytdl/{output_url}.txt", "w") as output_file:
|
||||||
|
output_file.write(output_url)
|
||||||
|
output_file.close()
|
||||||
else:
|
else:
|
||||||
print("Invalid argument")
|
print("Invalid argument")
|
||||||
return 1
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue