aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-09-24 09:54:17 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-09-24 10:42:06 +0200
commit072a0a65f9fc964e6b9975b50a262e88d5c43b08 (patch)
tree0fb2d4352958aea7cba81ecaea6c4281f18035c3 /README.md
parentMerge pull request #449 from python-discord/duration-converter-fix (diff)
Prevent false-positives of the rich embed filter
https://github.com/python-discord/bot/issues/293 The rich embed filter is plagued by false positives now Discord has added more custom preview embeds for various websites. Since these embeds have the `rich` type instead of the `link` type, these embeds triggered the filter we had in place. This commit remedies that by using the existing URL regex pattern to list all the URLs contained in the message content and then checking if the embed url is a member of that list. If so, it's very likely that the embed was auto-generated from that URL, so we should ignore it. This approach deviates slightly from that outlined in #293. This does increase the probability of a false-negative, as a "true" user-generated rich embed could also have a url that's contained in the message body. However, I've checked most of the triggers we have had in the past and none of the legitimate triggers would have been a false-negative under the new rules. Therefore, I think it's very reasonable to adopt this strategy. In addition to the change in behavior of the rich embed filter, I have also kaizened the existing regex patterns by compiling them at load time. Since we check a lot of regex patterns for every message received by the bot, this should be beneficial for performance.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions