-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
arged responses #3418
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
base: development
Are you sure you want to change the base?
arged responses #3418
Changes from all commits
312f137
0bd96b8
fed5044
3972f9c
b3dd8a0
b1136e5
bab4fdb
95751df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |||||||||
| from dateutil import parser | ||||||||||
|
|
||||||||||
| from core import checks | ||||||||||
| from core.models import DMDisabled, PermissionLevel, SimilarCategoryConverter, getLogger | ||||||||||
| from core.models import DMDisabled, PermissionLevel, SimilarCategoryConverter, UnseenFormatter, getLogger | ||||||||||
| from core.paginator import EmbedPaginatorSession | ||||||||||
| from core.thread import Thread | ||||||||||
| from core.time import UserFriendlyTime, human_timedelta | ||||||||||
|
|
@@ -535,6 +535,195 @@ async def snippet_rename(self, ctx, name: str.lower, *, value): | |||||||||
| embed = create_not_found_embed(name, self.bot.snippets.keys(), "Snippet") | ||||||||||
| await ctx.send(embed=embed) | ||||||||||
|
|
||||||||||
| @commands.group(invoke_without_command=True) | ||||||||||
| @checks.has_permissions(PermissionLevel.SUPPORTER) | ||||||||||
| async def args(self, ctx, *, name: str.lower = None): | ||||||||||
| """ | ||||||||||
| Create dynamic args for use in replies. | ||||||||||
|
|
||||||||||
| When `{prefix}args` is used by itself, this will retrieve | ||||||||||
| a list of args that are currently set. `{prefix}args name` will show what the | ||||||||||
| arg point to. | ||||||||||
|
||||||||||
| arg point to. | |
| arg points to. |
Copilot
AI
Jan 16, 2026
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.
The documentation states "You can use your arg in a reply with {arg-name}" but doesn't mention that args only work in certain reply commands (reply, freply, fareply, fpreply, fpareply) and not in others (areply, preply, pareply). Consider updating the documentation to clarify which commands support args to avoid user confusion.
| You can use your arg in a reply with `{arg-name}`. | |
| You can use your arg in supported reply commands (` | |
| reply`, `freply`, `fareply`, `fpreply`, `fpareply`) with `{arg-name}`. Args are | |
| not available in `areply`, `preply`, or `pareply`. |
Copilot
AI
Jan 16, 2026
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.
The args command uses direct name lookup without resolving through aliases like the snippet command does with _resolve_snippet. This creates an inconsistency where snippets can be accessed via their aliases but args cannot. Consider adding a _resolve_arg method similar to _resolve_snippet to provide consistent behavior.
Copilot
AI
Dec 27, 2025
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.
Spelling error: "dont" should be "don't".
| description="You dont have any args at the moment.", | |
| description="You don't have any args at the moment.", |
Copilot
AI
Jan 16, 2026
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.
Inconsistent contraction usage: "dont" should be "don't" with an apostrophe.
| description="You dont have any args at the moment.", | |
| description="You don't have any args at the moment.", |
lorenzo132 marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Dec 27, 2025
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.
Missing validation: The args_add command should validate that the arg name doesn't conflict with existing command names or aliases, similar to how snippet_add does. This prevents creating args with names that could conflict with bot commands.
Copilot
AI
Jan 16, 2026
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.
The args_add command doesn't check if the arg name conflicts with existing commands, snippets, or aliases, unlike snippet_add which has these validation checks. This could lead to confusion or unexpected behavior. Consider adding similar validation to prevent args from conflicting with commands, snippets, or aliases.
Copilot
AI
Jan 16, 2026
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.
The args feature doesn't validate against reserved variable names that could conflict with format variables in the freply, fareply, fpreply, and fpareply commands (e.g., "channel", "recipient", "author"). Users could create args with these names, leading to unexpected behavior where the built-in variables override the user-defined args. Consider adding validation in args_add and args_rename to prevent using these reserved names.
lorenzo132 marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Dec 27, 2025
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.
Missing validation: The args_rename command should validate that the new name doesn't conflict with existing command names or aliases, similar to how snippet_rename does (lines 494-516 in this file). This prevents creating args with names that could conflict with bot commands.
Copilot
AI
Dec 27, 2025
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.
Inconsistent formatter usage: The reply command uses UnseenFormatter which preserves unknown placeholders like {unknown}, while freply, fareply, fpreply, and fpareply use SafeFormatter which replaces them with "". This creates inconsistent behavior when users use args in different reply commands. Consider using UnseenFormatter consistently across all reply commands, or ensure SafeFormatter is used in the reply command as well for consistency.
| msg = UnseenFormatter().format(msg, **self.bot.args) | |
| msg = self.bot.formatter.format(msg, **self.bot.args) |
Copilot
AI
Jan 16, 2026
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.
In the freply, fareply, fpreply, and fpareply commands, args are added before the built-in variables (channel, recipient, author). This means that if an arg is named "channel", "recipient", or "author", it will be overridden by the built-in variables, potentially causing unexpected behavior. Consider either adding args after the built-in variables (so built-in variables take precedence) or documenting this behavior and warning users not to use reserved names.
Copilot
AI
Jan 16, 2026
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.
In the freply, fareply, fpreply, and fpareply commands, args are added before the built-in variables (channel, recipient, author). This means that if an arg is named "channel", "recipient", or "author", it will be overridden by the built-in variables, potentially causing unexpected behavior. Consider either adding args after the built-in variables (so built-in variables take precedence) or documenting this behavior and warning users not to use reserved names.
Copilot
AI
Jan 16, 2026
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.
In the freply, fareply, fpreply, and fpareply commands, args are added before the built-in variables (channel, recipient, author). This means that if an arg is named "channel", "recipient", or "author", it will be overridden by the built-in variables, potentially causing unexpected behavior. Consider either adding args after the built-in variables (so built-in variables take precedence) or documenting this behavior and warning users not to use reserved names.
Copilot
AI
Jan 16, 2026
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.
In the freply, fareply, fpreply, and fpareply commands, args are added before the built-in variables (channel, recipient, author). This means that if an arg is named "channel", "recipient", or "author", it will be overridden by the built-in variables, potentially causing unexpected behavior. Consider either adding args after the built-in variables (so built-in variables take precedence) or documenting this behavior and warning users not to use reserved names.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -109,7 +109,7 @@ async def format_cog_help(self, cog, *, no_cog=False): | |||||||||||||
| return embeds | ||||||||||||||
|
|
||||||||||||||
| def process_help_msg(self, help_: str): | ||||||||||||||
| return help_.format(prefix=self.context.clean_prefix) if help_ else "No help message." | ||||||||||||||
| return help_.replace("{prefix}", self.context.clean_prefix) if help_ else "No help message." | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+112
to
113
|
||||||||||||||
| return help_.replace("{prefix}", self.context.clean_prefix) if help_ else "No help message." | |
| if not help_: | |
| return "No help message." | |
| formatter = UnseenFormatter() | |
| return formatter.format(help_, prefix=self.context.clean_prefix) |
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.
Grammar error: "arg point to" should be "arg points to" (subject-verb agreement).