website/pkg/spam/spam.go

33 lines
1022 B
Go
Raw Normal View History

package spam
import (
"errors"
"strings"
)
// SpamWebsites to third-party video hosting apps: we already have our own chat room, and third-party links shared in
// public places can pose a risk to user privacy/safety.
var SpamWebsites = []string{
"join.skype.com",
"zoom.us",
"whereby.com",
"meet.jit.si",
"https://t.me",
}
// DetectSpamMessage searches a message (such as a comment, forum post, etc.) for spammy contents such as Skype invite links
// and returns an error if found.
func DetectSpamMessage(message string) error {
for _, link := range SpamWebsites {
if strings.Contains(message, link) {
return errors.New(
"Your message could not be posted because it contains a link to a third-party video chat website. " +
"In the interest of protecting our community, we do not allow linking to third-party video conferencing apps where user " +
"privacy and security may not hold up to our standards, or where the content may run against our terms of service.",
)
}
}
return nil
}