Add warning to [p]set api if <>s are included in secret #6265
No reviewers
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!6265
Loading…
Reference in a new issue
No description provided.
Delete branch "anglebracket-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
@ -3633,8 +3633,22 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):else: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
You should explicitly clarify that it is wrapped by <> current sentence implies that < or > is found in the token/key
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"
Field name should be translated
@ -3636,0 +3642,4 @@" 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)Log messages shouldn't be translated and should remain on the same language as the software
@Drapersniper I added the changes requested in your comments as another commit on the PR, thanks
Just a couple of suggested changes to improve readability.
@ -3636,0 +3640,4 @@"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>"Wrapping the command examples with inline marks may be appropriate to improve readability.
@ -3638,0 +3648,4 @@await ctx.send(_("`{service}` API tokens have been set.").format(service=service),embed=embed if len(embed.fields) > 0 else None,)It isn't necessary to give this warning inside of an embed, when there is already text content (it would make things more complicated, such as having to check if an embed is requested in the current channel). Instead, you could add line breaks under the original message and put the warning text there. Something like this would suffice:
Remember to remove the
embeddefinition on line 3636.Superseded by #6651
Pull request closed