Skip to content

Commit

Permalink
Corrected for PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
giplgwm committed Nov 2, 2023
1 parent 2b8296c commit b57e275
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions redbot/core/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3634,19 +3634,21 @@ async def _set_api(
if ctx.bot_permissions.manage_messages:
await ctx.message.delete()
embed = discord.Embed()
for dict_key, token in tokens.items():
for api_service_name, token in tokens.items():
if token.startswith("<") and token.endswith(">"):
angle_bracket_warning = _(
"Your `{dict_key}` was set including the <> symbols. If this was an accident you may experience"
" issues with `{service}`. In that case, please try setting your `{dict_key}` again with"
" the < and > removed"
).format(dict_key=dict_key, service=service)
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)
embed.add_field(name="Warning", value=angle_bracket_warning)
embed.add_field(name=_("Warning"), value=_(angle_bracket_warning))
await ctx.bot.set_shared_api_tokens(service, **tokens)
if embed:
await ctx.send(embed=embed)
await ctx.send(_("`{service}` API tokens have been set.").format(service=service))
await ctx.send(
_("`{service}` API tokens have been set.").format(service=service),
embed=embed if len(embed.fields) > 0 else None,
)

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

0 comments on commit b57e275

Please sign in to comment.