Case insensitive at-mention for the chatbot

This commit is contained in:
Noah 2023-08-13 22:21:29 -07:00
parent 9c8ff88f6e
commit a1aedea2f4

View File

@ -46,7 +46,7 @@ func AtMentioned(c *Client, message string) (bool, string) {
// Patterns to look for. // Patterns to look for.
var ( var (
reAtMention = regexp.MustCompile( reAtMention = regexp.MustCompile(
fmt.Sprintf(`^@?%s|@?%s$`, c.Username(), c.Username()), fmt.Sprintf(`(?i)^@?%s|@?%s$`, c.Username(), c.Username()),
) )
) )
m := reAtMention.FindStringSubmatch(message) m := reAtMention.FindStringSubmatch(message)