[V3 Alias] Parameterized and fixed-argument command aliases #2011

Closed
opened 2018-08-13 06:52:08 +02:00 by calebj · 8 comments
calebj commented 2018-08-13 06:52:08 +02:00 (Migrated from github.com)

Feature request

Select the type of feature you are requesting:

  • Command

Describe your requested feature

I've been in the situation where I or other users want to create shortcuts for long commands with parameters in the middle of those commands, instead of at the end. On the other hand, I've also wanted to prevent any parameters from being added to the end of the aliased command. The Alias cog is the right place to add both.

I wouldn't mind doing this, but it should be fairly simple to put together. I also don't want to start another thing unless it's wanted in core.

What it would probably involve:

  • Switch to using discord.py's view machinery for argument parsing parity
  • Add syntax for designating defaults or required arguments to aliases
  • More things I haven't thought of yet

Update
At the current moment, it seems as though some of what was requested by this issue has been addressed in #2455. However, Alias still does not support adding defaults to custom parameters.

# Feature request #### Select the type of feature you are requesting: - [x] Command #### Describe your requested feature I've been in the situation where I or other users want to create shortcuts for long commands with parameters in the middle of those commands, instead of at the end. On the other hand, I've also wanted to prevent any parameters from being added to the end of the aliased command. The Alias cog is the right place to add both. I wouldn't mind doing this, but it should be fairly simple to put together. I also don't want to start another thing unless it's wanted in core. What it would probably involve: - Switch to using discord.py's view machinery for argument parsing parity - Add syntax for designating defaults or required arguments to aliases - More things I haven't thought of yet --- **Update** At the current moment, it seems as though some of what was requested by this issue has been addressed in #2455. However, Alias still does not support adding defaults to custom parameters.
Tobotimus commented 2018-08-13 07:00:41 +02:00 (Migrated from github.com)

I like the suggestion, I've always wanted to write this cog, and have never got around to it. However, I want us to be careful, since as it stands alias is quite a simple cog and I'd like to keep it that way on the front-end - adding these extra features should aim to avoid overwhelming the user with lots of options. Perhaps adding an extra [p]advalias (short for advanced alias) will help to separate the two, so the simplicity of the [p]alias command is retained?

I like the suggestion, I've always wanted to write this cog, and have never got around to it. However, I want us to be careful, since as it stands alias is quite a simple cog and I'd like to keep it that way on the front-end - adding these extra features should aim to avoid overwhelming the user with lots of options. Perhaps adding an extra `[p]advalias` (short for advanced alias) will help to separate the two, so the simplicity of the `[p]alias` command is retained?
calebj commented 2018-08-13 07:35:16 +02:00 (Migrated from github.com)

Though it would have to have a per-alias toggle to prevent potentially changing behavior on old aliases, I'm opposed in principle to mixing command groups and normal commands. I would keep it under [p]alias but keep the idea by making it a subcommand named advanced that toggles the aforementioned setting. An example of this kind of convention is trigger's regex toggle.

Perhaps a toggle is all that would be needed, if the syntax can be self-describing. Consider:

!aliased {0:foo} "{*2:baz=default value 2}" {1:bar=default value 1}

The first alias parameter is required, since it has no default. The second alias parameter (bar) will be placed last in the substitution, but will be without quotes to allow a *consume_rest mode of operation. And the third alias parameter (baz) will be placed in quotes, but will do its own *consume_rest due to the asterisk on it. Both default values contain spaces. Not everyone will use these modes of operation, of course, but they're fairly close to the way you'd write the command in Python.

Though it *would* have to have a per-alias toggle to prevent potentially changing behavior on old aliases, I'm opposed in principle to mixing command groups and normal commands. I would keep it under `[p]alias` but keep the idea by making it a subcommand named `advanced` that toggles the aforementioned setting. An example of this kind of convention is trigger's regex toggle. Perhaps a toggle is all that would be needed, if the syntax can be self-describing. Consider: ``` !aliased {0:foo} "{*2:baz=default value 2}" {1:bar=default value 1} ``` The first alias parameter is required, since it has no default. The second alias parameter (`bar`) will be placed last in the substitution, but will be without quotes to allow a `*consume_rest` mode of operation. And the third alias parameter (`baz`) will be placed in quotes, but will do its own `*consume_rest` due to the asterisk on it. Both default values contain spaces. Not everyone will use these modes of operation, of course, but they're fairly close to the way you'd write the command in Python.
mikeshardmind commented 2020-01-04 05:50:03 +01:00 (Migrated from github.com)

wew, this one fell threw the cracks. Merged a long time ago

wew, this one fell threw the cracks. Merged a long time ago
mikeshardmind commented 2020-01-04 05:51:07 +01:00 (Migrated from github.com)

Or I can misread this, sorry that was CC which fully handles this already.

Or I can misread this, sorry that was CC which fully handles this already.
Zephyrkul commented 2020-01-04 06:44:25 +01:00 (Migrated from github.com)

Didn't #2455 add this functionality?

Didn't #2455 add this functionality?
mikeshardmind commented 2020-01-04 06:45:01 +01:00 (Migrated from github.com)

I thought that didn't handle default values for alias, but I'm not the largest alias user, did I miss something with that?

I thought that didn't handle default values for alias, but I'm not the largest alias user, did I miss something with that?
Zephyrkul commented 2020-01-04 06:46:25 +01:00 (Migrated from github.com)

Ah, sorry, no it doesn't. I didn't see that comment further down. Worth noting that CC doesn't handle default arguments either.

Ah, sorry, no it doesn't. I didn't see that comment further down. Worth noting that CC doesn't handle default arguments either.
Owner

Offene Diskussion bzw. Feature-Wunsch mit geringem Nutzen im Verhältnis zum Aufwand (oder Nischenfall), der seit Langem ohne Ergebnis offen ist. Ich schließe das Issue; bei konkretem Bedarf kann es gern wieder geöffnet werden.


Generated by Claude Code

Offene Diskussion bzw. Feature-Wunsch mit geringem Nutzen im Verhältnis zum Aufwand (oder Nischenfall), der seit Langem ohne Ergebnis offen ist. Ich schließe das Issue; bei konkretem Bedarf kann es gern wieder geöffnet werden. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
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
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#2011
No description provided.