Jda: Changing Message#getContentStripped

Created on 4 Dec 2018  路  6Comments  路  Source: DV8FromTheWorld/JDA

General Troubleshooting

  • [x] I have checked for similar issues.
  • [x] I have updated to the latest JDA version.
  • [x] I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

Issue

Issue Type

  • [ ] Bug Report
  • [x] Feature Request

Description

At the moment does Message#getContentStripped(); remove symbols like * if they format the text (For example *text* becomes text).
But sadly is that also the case when the symbol is escaped, what also makes it look weird (\*text* becomes \text)
Would it be possible, to change that in a way, that it won't remove the symbols, if they are escaped.

novice completed enhancement

Most helpful comment

Turns out markdown is even more complicated than I imagined. A simple state-machine won't work because something like "`abc **x**" requires a backtracking algorithm.

All 6 comments

Adding spoilers to Message#getContentStripped would also be nice.

Released Issue: https://github.com/DV8FromTheWorld/JDA/issues/906

I'm currently working on something that could be used here: MarkdownSanitizer. This is still a WIP class but its probably a better approach to have a dedicated state-machine for sanitizing markdown formats.

Turns out markdown is even more complicated than I imagined. A simple state-machine won't work because something like "`abc **x**" requires a backtracking algorithm.

This is available as of 4.ALPHA.0_55

But would that now allow to make \*Your text* *And formatted text* become *Your text* And formatted text in Message#getContentStripped();?

That would have to be \*Your text\* *And formatted text* instead to be escaped correctly

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hitsu420 picture hitsu420  路  6Comments

xeu100 picture xeu100  路  5Comments

andrei1058 picture andrei1058  路  6Comments

istamendil picture istamendil  路  3Comments

liovy picture liovy  路  3Comments