blattersturm / discord-papercuts

Bubble's repository for Discord's 'death by a thousand papercuts' issues
3 stars 0 forks source link

Message editing via `s/` prefix is weird #2

Open blattersturm opened 3 years ago

blattersturm commented 3 years ago

Ever since this functionality got added on a whim in 2016, sending a message matching ^s/.+/ is impossible, as it will edit the last message with this 'sed' syntax.

Sadly, this implementation of 'sed' syntax has a few obvious bugs, none of which have been noticed or fixed since this functionality got added:

  1. You need to omit the / at the end of the s/ expression. This would be invalid in real sed, and not omitting it leads to the replacement having a / in the edited message.
  2. It doesn't support regular expressions. Some IRC bots did. By eating all messages that contain this, you also can't implement this in a bot yourself.
  3. It only edits the last message you sent - it doesn't go up to any messages before.
  4. If no match is found, your message is edited (with no change, other than adding an 'edited' marker), and the message you wrote starting with s/ is deleted entirely, with no way to recall it. This makes for fun when trying to do the classical IRC use case of:

    1. \ i made an dollar today
    2. \ s/an /a /

    ... as your message gets eaten entirely. If this were a long message, such as s/an dollar/a monetary unit known as a dollar/, your message is gone with the wind, and your last message before that got a magical no-op edit.