Update Spotify API instructions + use SetApiView (#6699)

This commit is contained in:
Jakub Kuczys
2026-03-15 12:57:14 +01:00
committed by GitHub
parent e8f0ea0510
commit 9270373c56

View File

@@ -16,6 +16,7 @@ from redbot.core.i18n import Translator
from redbot.core.utils.chat_formatting import box, humanize_number
from redbot.core.utils.menus import menu, start_adding_reactions
from redbot.core.utils.predicates import MessagePredicate, ReactionPredicate
from redbot.core.utils.views import SetApiView
from ...audio_dataclasses import LocalPath
from ...converters import ScopeParser
@@ -1280,26 +1281,38 @@ class AudioSetCommands(MixinMeta, metaclass=CompositeMetaClass):
"6. Click on Create Credential at the top.\n"
'7. At the top click the link for "API key".\n'
"8. No application restrictions are needed. Click Create at the bottom.\n"
"9. You now have a key to add to `{prefix}set api youtube api_key <your_api_key_here>`"
).format(prefix=ctx.prefix)
await ctx.maybe_send_embed(message)
"9. Click the button below this message and set your API key"
" with the data shown in Google Developers Console."
)
await ctx.send(
message,
view=SetApiView(default_service="youtube", default_keys={"api_key": ""}),
)
@command_audioset.command(name="spotifyapi")
@commands.is_owner()
async def command_audioset_spotifyapi(self, ctx: commands.Context):
"""Instructions to set the Spotify API tokens."""
message = _(
"1. Go to Spotify developers and log in with your Spotify account.\n"
"(https://developer.spotify.com/dashboard/applications)\n"
'2. Click "Create An App".\n'
"3. Fill out the form provided with your app name, etc.\n"
'4. When asked if you\'re developing commercial integration select "No".\n'
"5. Accept the terms and conditions.\n"
"6. Copy your client ID and your client secret into:\n"
"`{prefix}set api spotify client_id <your_client_id_here> "
"client_secret <your_client_secret_here>`"
).format(prefix=ctx.prefix)
await ctx.maybe_send_embed(message)
"1. Go to Spotify for Developers and log in with your Spotify account."
" If this is your first time, you'll be asked to accept the terms and conditions.\n"
"(https://developer.spotify.com/dashboard)\n"
'2. Click "Create app".\n'
"3. Fill out the form provided with your app name and description."
" These can be anything you want. Website field can be left empty.\n"
"4. Add `https://localhost` to your Redirect URIs. This will not be used"
" but is required when filling out the form.\n"
'5. Select "Web API" when asked which API/SDKs you are planning to use.\n'
"6. Confirm that you agree to the terms and conditions and save the application.\n"
"7. Click the button below this message and set your client ID and your client secret"
" with the data shown in Spotify's dashboard."
)
await ctx.send(
message,
view=SetApiView(
default_service="spotify", default_keys={"client_id": "", "client_secret": ""}
),
)
@command_audioset.command(name="countrycode")
@commands.guild_only()