-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warning to [p]set api if <>s are included in secret #6265
base: V3/develop
Are you sure you want to change the base?
Conversation
redbot/core/core_commands.py
Outdated
await ctx.bot.set_shared_api_tokens(service, **tokens) | ||
if embed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be always the case with this command so this check is obsolete
You merge the card.send to send both the string and the new embed by specifying keyword arguments in that function
redbot/core/core_commands.py
Outdated
for dict_key, 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should explicitly clarify that it is wrapped by <> current sentence implies that < or > is found in the token/key
redbot/core/core_commands.py
Outdated
for dict_key, 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For translatable strings, I would personally suggest naming the formatting variable something contextual so that translators are better aware of the translation context for example "api_service_name"
redbot/core/core_commands.py
Outdated
" the < and > removed" | ||
).format(dict_key=dict_key, service=service) | ||
log.warning(angle_bracket_warning) | ||
embed.add_field(name="Warning", value=angle_bracket_warning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field name should be translated
@Drapersniper I added the changes requested in your comments as another commit on the PR, thanks |
Description of the changes
Closes #6253
For every given secret, check if its wrapped in <>, if it is, add a message to an embed with a warning that that secret may not be set properly. I tested this on a local instance of the bot and it seems to be working as expected. The warning is also logged
Have the changes in this PR been tested?
Yes