commit 474cb6125ccd6c07958e9b6edf185849f11a7eaa
parent 6820462ff60fbf1fc60126133cc5af293eda377f
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 22 Dec 2022 12:58:47 -0800
move code
Diffstat:
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/pkg/web/handlers/api/v1/handlers.go b/pkg/web/handlers/api/v1/handlers.go
@@ -54,6 +54,7 @@ var unkickRgx = regexp.MustCompile(`^/(?:unkick|uk) ` + optAtGUser)
var hellbanRgx = regexp.MustCompile(`^/(?:hellban|hb) ` + optAtGUser)
var unhellbanRgx = regexp.MustCompile(`^/(?:unhellban|uhb) ` + optAtGUser)
var tokenRgx = regexp.MustCompile(`^/token (\d{1,2})$`)
+var snippetRgx = regexp.MustCompile(`!\w{1,20}`)
var tagRgx = regexp.MustCompile(`@(` + userOr0 + `)`)
var autoTagRgx = regexp.MustCompile(`@(\w+)\*`)
var roomTagRgx = regexp.MustCompile(`#(` + roomNameF + `)`)
diff --git a/pkg/web/handlers/api/v1/snippetInterceptor.go b/pkg/web/handlers/api/v1/snippetInterceptor.go
@@ -3,7 +3,6 @@ package v1
import (
"dkforest/pkg/database"
"dkforest/pkg/managers"
- "regexp"
"strings"
)
@@ -19,8 +18,6 @@ func (i SnippetInterceptor) InterceptMsg(cmd *Command) {
cmd.message = cmd.origMessage
}
-var snippetRgx = regexp.MustCompile(`!\w{1,20}`)
-
func snippets(authUserID database.UserID, html string) string {
if snippetRgx.MatchString(html) {
userSnippets, _ := database.GetUserSnippets(authUserID)