feat: added musicdownloader cog
This commit is contained in:
parent
55aa09592f
commit
a82ad5debc
3 changed files with 38 additions and 0 deletions
5
musicdownloader/__init__.py
Normal file
5
musicdownloader/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from .musicdownloader import MusicDownloader
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(MusicDownloader(bot))
|
8
musicdownloader/info.json
Normal file
8
musicdownloader/info.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"author" : ["SeaswimmerTheFsh"],
|
||||||
|
"install_msg" : "Thank you for installing MusicDownloader!\nYou can find the source code of this cog here: https://github.com/SeaswimmerTheFsh/GalaxyCogs",
|
||||||
|
"name" : "MusicDownloader",
|
||||||
|
"short" : "Custom cog intended for use on the Galaxy discord server.",
|
||||||
|
"description" : "Custom cog intended for use on the Galaxy discord server.",
|
||||||
|
"end_user_data_statement" : "This cog does not store any End User Data."
|
||||||
|
}
|
25
musicdownloader/musicdownloader.py
Normal file
25
musicdownloader/musicdownloader.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import discord
|
||||||
|
import yt_dlp
|
||||||
|
from os import path
|
||||||
|
from redbot.core import commands, checks, Config, data_manager
|
||||||
|
|
||||||
|
class MusicDownloader(commands.Cog):
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
self.config = Config.get_conf(self, identifier=475728338)
|
||||||
|
self.config.register_global(
|
||||||
|
save_directory = data_manager.cog_data_path()
|
||||||
|
)
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
async def change_data_path(self, ctx: commands.Context, data_path: str = None):
|
||||||
|
"""This command changes the data path this cog outputs to."""
|
||||||
|
old_path = await self.config.save_directory()
|
||||||
|
if path.isdir(data_path):
|
||||||
|
await self.config.save_directory.set(data_path)
|
||||||
|
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"The save directory has been set to `{data_path}`.\n It was previously set to `{old_path}`.")
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
elif path.isfile(data_path):
|
||||||
|
await ctx.send("The path you've provided leads to a file, not a directory!")
|
||||||
|
elif path.exists(data_path) is False:
|
||||||
|
await ctx.send("The path you've provided doesn't exist!")
|
Loading…
Reference in a new issue