diff options
| author | Rapptz <[email protected]> | 2018-03-06 01:16:00 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-03-06 01:16:00 -0500 |
| commit | d8a85f48983e78fa036579b3c5de4cfd8cf332db (patch) | |
| tree | 8911a9803ae396b8b8f10d7ec6f01a16670a028e /discord/ext/commands/view.py | |
| parent | [commands] Added handling for unicode quotes (diff) | |
| download | discord.py-d8a85f48983e78fa036579b3c5de4cfd8cf332db.tar.xz discord.py-d8a85f48983e78fa036579b3c5de4cfd8cf332db.zip | |
[commands] Minor optimisations to unicode quote handling.
Diffstat (limited to 'discord/ext/commands/view.py')
| -rw-r--r-- | discord/ext/commands/view.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/discord/ext/commands/view.py b/discord/ext/commands/view.py index 65f96e18..2319265d 100644 --- a/discord/ext/commands/view.py +++ b/discord/ext/commands/view.py @@ -143,8 +143,11 @@ def quoted_word(view): close_quote = _quotes.get(current) is_quoted = bool(close_quote) if is_quoted: - open_quote = current - result = [] if is_quoted else [current] + result = [] + _escaped_quotes = (current, close_quote) + else: + result = [current] + _escaped_quotes = _all_quotes while not view.eof: current = view.get() @@ -166,7 +169,7 @@ def quoted_word(view): # if we aren't then we just let it through return ''.join(result) - if next_char in ((open_quote, close_quote) if is_quoted else _all_quotes): + if next_char in _escaped_quotes: # escaped quote result.append(next_char) else: |