Added cores flag for Startup

This commit is contained in:
Lukas Blacha
2023-02-08 17:42:53 +01:00
parent 71e76d754d
commit 443eec8320

View File

@@ -28,8 +28,16 @@ cache_dir = "cache"
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--token", help="Bot TOKEN")
parser.add_argument("-c", "--cores", help="Number of Cores for ffmpeg (Standard 2)")
args = parser.parse_args()
if args.cores == None:
threads = 2
else:
threads = int(args.cores)
if args.token == None:
print(f"{banner}\n\nPLEASE PROVIDE BOT A TOKEN BY RUNNING LIKE THE FOLLOWING:")
print("\n")
@@ -85,7 +93,7 @@ else:
filename = data["url"] if stream else ytdl.prepare_filename(data)
return cls(discord.FFmpegPCMAudio(source=filename, executable="ffmpeg", pipe=False, stderr=False,
before_options="-threads 2", options=ffmpeg_options), data=data)
before_options=f"-threads {threads}", options=ffmpeg_options), data=data)
async def youtube_search(search: str):
@@ -115,6 +123,7 @@ else:
print(banner)
print(f"Bot Version: {version} ({branch})")
print(f"Bot: {bot.user} (ID: {bot.user.id})")
print(f"Threads for ffmpeg: {threads}")
print(
f"Invitation LINK: https://discord.com/api/oauth2/authorize?client_id={bot.user.id}&permissions=968552344896&scope=bot%20applications.commands")
print("------")