Skip to content

more user‐friendly handling of chat commands

Jeff Schaller edited this page Apr 28, 2024 · 25 revisions
  1. Come up with a proposal (all-inclusive?) and post it as an Issue (Feature request) on the CHQ repo: https://github.com/Charcoal-SE/SmokeDetector/issues and self-assign it.
    • Problem = users not remembering (or being careful enough with) the strict syntax of some chat commands.
    • Solution = accommodate common user inputs in various chat commands.
    • Alternatives = (a) pick and choose which to implement; (b) leave the chat command parsing as-is.
    • Context = rough search numbers of raw hits and percent-error for the various chat commands.
  2. Guide the discussion towards which modifications you'd like to see included or excluded.
  3. create PR with the consensus and link it to the Issue/FR

Items:

  • report: make the whitespace splitting more forgiving (previously https://github.com/Charcoal-SE/SmokeDetector/pull/10755). In situations where multiple spaces exist after the URL(s) and before the custom reason, the first element of "argsraw" might have trailing space(s), resulting in the message "That does not look like a valid post URL". This change uses string.split()'s behavior with sep=None to regard runs of consecutive whitespace as a single separator (https://docs.python.org/3.3/library/stdtypes.html#str.split). This change also allows for multiple spaces between URLs. Code change = urls = argsraw[0].split(' ') to urls = argsraw[0].split(sep=None)

  • reject: allow for missing double-quotes around the reason; would accept: !!/reject 12345 5 false positives, no known hits.; match: "\d+ then 19+ characters" without double-quotes

  • reject: make an exception when < 20 chars, if: matched by: 'superseded by \d+' or (match('author') && match('request')); would accept !!/reject 12345 superseded by 54321 or !!/reject 12345 "at author's request" or !!/reject 12345 "requested by author" (both 19 characters!)

  • watch: allow leading whitespace in the pattern

  • addblu: allow a trailing comment (and just throw away the comment); might be better placed in get_user_from_list_command, which would modify multiple commands' behavior

Context:

command error response count error total command (total search hits) error %
report That does not look like a valid post URL **276 ** 32085 0.008602150538
reject Please provide an adequate reason for rejection (at least 20 characters long) so the user **78 ** 1286 0.06065318818
blacklist-keyword "The pattern starts with whitespace." **68 ** 30926 0.002198797129
addblu "Invalid format. Valid format: !!/addblu profileurl or !!/addblu userid sitename." 40 1677 0.02385211688
isblu "Invalid format. Valid format: !!/isblu profileurl or !!/isblu userid sitename." 33 629 0.05246422893
rmwlu "Invalid format. Valid format: !!/rmwlu profileurl or !!/rmwlu userid sitename." 5 64 0.078125