[Alias] Properly track whitespace for use #2706

Closed
mikeshardmind wants to merge 3 commits from alias-newlines into V3/develop
mikeshardmind commented 2019-05-19 09:04:57 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Actually tracks the whitespace used instead of assuming it's all spaces, later restores the tracked whitespace.

fixes #​2704

### Type - [X] Bugfix - [ ] Enhancement - [ ] New feature ### Description of the changes Actually tracks the whitespace used instead of assuming it's all spaces, later restores the tracked whitespace. fixes #​2704
tekulvw (Migrated from github.com) reviewed 2019-05-19 09:04:57 +02:00
Olaroll commented 2019-05-19 10:35:59 +02:00 (Migrated from github.com)

The alias no longer works if it starts with a line break. I'm no programmer though, so I don't really know why that is.
EDIT: it does work if there's a space after the alias, then a line break.

DiscordPTB_2019-05-19_11-30-39
DiscordPTB_2019-05-19_11-45-13

The alias no longer works if it starts with a line break. I'm no programmer though, so I don't really know why that is. EDIT: it does work if there's a space after the alias, then a line break. ![DiscordPTB_2019-05-19_11-30-39](https://user-images.githubusercontent.com/13151772/57979675-d2c6c300-7a29-11e9-9053-cee8dc7a1822.png) ![DiscordPTB_2019-05-19_11-45-13](https://user-images.githubusercontent.com/13151772/57979888-0d315f80-7a2c-11e9-8700-3954c6490987.png)
mikeshardmind commented 2019-05-19 11:22:23 +02:00 (Migrated from github.com)

I've pushed a fix for that, but at this point I'm convinced that while this fixes the issue in the short term, it's not a sufficient long term solution.

Relying on discord.py's string view like this precludes the ability to have input to an alias such as

[p]somealias "this alias has no args and invokes something with consume-rest", "But this will still fail where the command wouldn't as a result of the comma after the prior quote"
I've pushed a fix for that, but at this point I'm convinced that while this fixes the issue in the short term, it's not a sufficient long term solution. Relying on discord.py's string view like this precludes the ability to have input to an alias such as ``` [p]somealias "this alias has no args and invokes something with consume-rest", "But this will still fail where the command wouldn't as a result of the comma after the prior quote" ```
mikeshardmind commented 2019-06-23 06:00:20 +02:00 (Migrated from github.com)

I'm still not happy with this as a solution for this. I think the better option might be to rewrite alias and customcom to not exhibit any of the odd issues related to this. Should probably freeze this unless someone sees an immediate need for only a partial fix on this edge case.

I'm still not happy with this as a solution for this. I think the better option might be to rewrite alias and customcom to not exhibit any of the odd issues related to this. Should probably freeze this unless someone sees an immediate need for only a partial fix on this edge case.
Tobotimus commented 2019-06-29 16:42:45 +02:00 (Migrated from github.com)

Considering putting this in as a hotfix for 3.1.3. Perhaps a rewrite of the alias internals is on the cards for 3.2.

Considering putting this in as a hotfix for 3.1.3. Perhaps a rewrite of the alias internals is on the cards for 3.2.

Pull request closed

Sign in to join this conversation.
No reviewers
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
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!2706
No description provided.