Merge pull request #3669 from InspectorCaracal/InspectorCaracal-patch-3

Fix CmdPage tracebacks
This commit is contained in:
Griatch 2024-11-11 20:18:10 +01:00 committed by GitHub
commit d54e6c5063
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1382,18 +1382,18 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
if target and target.isnumeric():
# a number to specify a historic page
number = int(target)
elif target:
elif message:
target_obj = self.caller.search(target, quiet=True)
if target_obj:
# a proper target
targets = [target_obj[0]]
message = message[0].strip()
else:
# a message with a space in it - put it back together
message = target + " " + (message[0] if message else "")
# a message with a space in it - use the original args
message = self.args.strip()
else:
# a single-word message
message = message[0].strip()
# a single-word message - use the original args
message = self.args.strip()
pages = list(pages_we_sent) + list(pages_we_got)
pages = sorted(pages, key=lambda page: page.date_created)