-
Notifications
You must be signed in to change notification settings - Fork 37
TypedSayCommand does not accept the colon character #244
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
Comments
Have you tried passing the URL in quotation marks? |
Yes, single and double quotes are no dice. It only appears to be when coming from chat commands; it works fine as a server console command (though that needs quotes) |
Looks like we need to split the arguments on our own instead of relying on |
FWIW, the single quote doesn't seem to work either (dunno why anyone would want that, in my case I wanted a hidden command for godmode when people said |
The Tokenize class I posted back in 2013 seems to have the desired outputs here: https://forums.sourcepython.com/viewtopic.php?p=1221#p1221 from re import compile
class Tokenize(list):
_pattern = compile('"[^"]*"|[^ ]+')
def __init__(self, given_string, comment_prefix=None):
self.string = given_string
for token_match in self._pattern.finditer(self.string):
token_string = token_match.group()
if comment_prefix and token_string.startswith(comment_prefix):
self.string = self.string[:token_match.start()]
break
self.append(token_string.strip('"'))
def __str__(self):
return self.string
print(repr(Tokenize('!mapdl http://test.com/test.bsp')))
# Result: ['!mapdl', 'http://test.com/test.bsp']
print(repr(Tokenize("I'M JOHN CENA")))
# Result: ["I'M", 'JOHN', 'CENA'] |
Le Québec invincible gagne encore! :-) I'm going to try monkey-patching the standard Tokenize with your regexp and see if it doesn't break anything in my code. If it works for everyone else, can we expect a PR from you, @invincibleqc ? EDIT: Actually, can't seem to find Tokenize anywhere, at least not on the Python side, and I'm not quite sure what |
Uh oh!
There was an error while loading. Please reload this page.
Game: Team Fortress 2
Input in chat:
!mapdl http://test.com/test.bsp
Code in question:
Error:
Works fine without the colon character. Not sure if this is just a parse issue or deliberately there? It also looks like it truncates everything after the colon, even if i did a *args:
('http', ':')
The text was updated successfully, but these errors were encountered: