mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-26 12:43:01 -05:00
Add #3995 in here
This commit is contained in:
@@ -1111,12 +1111,14 @@ class AudioSetCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
"Release date: [{build_time}]\n"
|
||||
"Lavaplayer version: [{lavaplayer}]\n"
|
||||
"Java version: [{jvm}]\n"
|
||||
"Java Executable: [{jv_exec}]\n"
|
||||
).format(
|
||||
build_time=self.player_manager.build_time,
|
||||
llbuild=self.player_manager.ll_build,
|
||||
llbranch=self.player_manager.ll_branch,
|
||||
lavaplayer=self.player_manager.lavaplayer,
|
||||
jvm=self.player_manager.jvm,
|
||||
jv_exec=self.player_manager.path,
|
||||
)
|
||||
if is_owner:
|
||||
msg += _("Localtracks path: [{localpath}]\n").format(**global_data)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import discord
|
||||
|
||||
@@ -18,6 +19,73 @@ class LavalinkSetupCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
async def command_llsetup(self, ctx: commands.Context):
|
||||
"""Lavalink server configuration options."""
|
||||
|
||||
@command_llsetup.command(name="java")
|
||||
async def command_llsetup_java(self, ctx: commands.Context, *, java_path: str = None):
|
||||
"""Change your Java executable path
|
||||
|
||||
Enter nothing to reset to default.
|
||||
"""
|
||||
external = await self.config.use_external_lavalink()
|
||||
if external:
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Invalid Environment"),
|
||||
description=_(
|
||||
"You cannot changed the Java executable path of "
|
||||
"external Lavalink instances from the Audio Cog."
|
||||
),
|
||||
)
|
||||
if java_path is None:
|
||||
await self.config.java_exc_path.clear()
|
||||
await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Java Executable Reset"),
|
||||
description=_("Audio will now use `java` to run your Lavalink.jar"),
|
||||
)
|
||||
else:
|
||||
exc = Path(java_path)
|
||||
exc_absolute = exc.absolute()
|
||||
if not exc.exists() or not exc.is_file():
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Invalid Environment"),
|
||||
description=_("`{java_path}` is not a valid executable").format(
|
||||
java_path=exc_absolute
|
||||
),
|
||||
)
|
||||
await self.config.java_exc_path.set(exc_absolute)
|
||||
await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Java Executable Changed"),
|
||||
description=_("Audio will now use `{exc}` to run your Lavalink.jar").format(
|
||||
exc=exc_absolute
|
||||
),
|
||||
)
|
||||
try:
|
||||
if self.player_manager is not None:
|
||||
await self.player_manager.shutdown()
|
||||
except ProcessLookupError:
|
||||
await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Failed To Shutdown Lavalink"),
|
||||
description=_(
|
||||
"For it to take effect please reload " "Audio (`{prefix}reload audio`)."
|
||||
).format(
|
||||
prefix=ctx.prefix,
|
||||
),
|
||||
)
|
||||
else:
|
||||
try:
|
||||
self.lavalink_restart_connect()
|
||||
except ProcessLookupError:
|
||||
await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Failed To Shutdown Lavalink"),
|
||||
description=_("Please reload Audio (`{prefix}reload audio`).").format(
|
||||
prefix=ctx.prefix
|
||||
),
|
||||
)
|
||||
|
||||
@command_llsetup.command(name="external")
|
||||
async def command_llsetup_external(self, ctx: commands.Context):
|
||||
"""Toggle using external Lavalink servers."""
|
||||
|
||||
Reference in New Issue
Block a user