Add default_search_platform option for customizable search platform

This commit is contained in:
Choco
2025-09-29 21:15:23 +08:00
parent f6722e538a
commit 3831c87f9b
7 changed files with 60 additions and 21 deletions

View File

@@ -214,7 +214,7 @@ class Basic(commands.Cog):
for search_type in voicelink.SearchType
])
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
async def search(self, ctx: commands.Context, *, query: str, platform: str = voicelink.SearchType.YOUTUBE.name):
async def search(self, ctx: commands.Context, *, query: str, platform: str = Config().search_platform.name):
"Searches your query and displays the results."
player: voicelink.Player = ctx.guild.voice_client
if not player:
@@ -226,7 +226,7 @@ class Basic(commands.Cog):
if url(query):
return await send_localized_message(ctx, "noLinkSupport", ephemeral=True)
search_type: voicelink.SearchType = voicelink.SearchType.match(platform) or voicelink.SearchType.YOUTUBE
search_type: voicelink.SearchType = voicelink.SearchType.match(platform) or Config().search_platform
tracks = await player.get_tracks(query=query, requester=ctx.author, search_type=search_type)
if not tracks:
return await send_localized_message(ctx, "noTrackFound")