Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion redbot/core/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3704,8 +3704,27 @@ async def _set_api(
else:
if ctx.bot_permissions.manage_messages:
await ctx.message.delete()

angle_bracket_warning = None

for api_service_name, token in tokens.items():
if token.startswith("<") and token.endswith(">"):
angle_bracket_warning = (
"You may have failed to properly format your {api_service_name}. If you were told to enter a key"
" with an example such as `[p]set api {service} api_key <your_api_key_here>`, and your API key"
" was `HREDFGWE`, make sure to run `[p]set api {service} api_key HREDFGWE` and not "
"`[p]set api {service} api_key <HREDFGWE>`."
).format(api_service_name=api_service_name, service=service)
log.warning(angle_bracket_warning)
break

await ctx.bot.set_shared_api_tokens(service, **tokens)
await ctx.send(_("`{service}` API tokens have been set.").format(service=service))

message = _("`{service}` API tokens have been set.").format(service=service)
if angle_bracket_warning:
message += "\n\n" + _("**Warning:** ") + _(angle_bracket_warning)

await ctx.send(message)

@_set_api.command(name="list")
async def _set_api_list(self, ctx: commands.Context):
Expand Down
Loading