Improve clean_content rationale and documentation #1911
Labels
docs needed
Documentation is needed for this change.
v1.0-alpha
This pertains to the rewrite version
While
Message.clean_content
is often used and recommended by people when they need message input "sanitized", I find that a lot of the time, very little thought is put into what this actually means.As I see it, most of the time, when someone needs their content "clean", they mean one of a few things:
@everyone
and@here
pings escaped (suitable for e.g. reminders, tagging or memos),Despite the wide array of interpretations, the documentation as of current commit doesn't really help narrow down what the property is aiming for:
discord.py/discord/message.py
Lines 378 to 386 in 3f06f24
A
"cleaned up" manner
really doesn't describe anything at all. Then it says it's as the client shows it, so maybe only text content, with no markdown? The mentions being transformed could describe any of the first two, but wait, it escapes@everyone
, so are we going for no side effects? Hold on, #1885 suggests we're escaping markdown, so are we going for raw instead?Perhaps
clean_content
should be split into multiple separate properties, each with separate goals to satisfy each condition? Or, maybe, it should be changed to a cleaning function instead, with arguments that allow the user to adjust exactly what they feel is the correct approach?Whichever way it ends up going, at the very least, the goal for the property should be clear and the documentation unambiguous, else each user will have no choice but to source dive to figure out exactly what to expect for something that should not really be all that complicated.
The text was updated successfully, but these errors were encountered: