Skip to content

Exclude Embed URLs from Auto Responce Matching #50

@semicolonTransistor

Description

@semicolonTransistor

This may be a minor nitpick but the auto-response can trigger on words that are part of an embed URL. For example, the "Goodbye matcher" triggers on this URL https://tenor.com/view/frank-sinatra-anchors-aweigh-hi-bye-see-ya-gif-13047761 which contains the word "bye".

It might make sense to stripe embed URLs from message contents before running it through the regexes for auto-responses to prevent the dad bot from triggering on seemingly text-free messages with just an image or other types of embed.

A possible solution is to iterate through the message object's "embeds" field and remove their URLs from the message's contents. (Code snippet inserted at line 56 of AutoResponce.ts)

if ("embeds" in msg) {
    msg.embeds.forEach((embed) => {
      if ("url" in embed) {
        msg.content = msg.content.replace(embed.url, "");
      }
    });
  }

Another option would be to use a URL-detecting regex to remove URLs from the message's contents, although URLs are complicated, and finding a good Regex for it is non-trivial.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions