basic Kick support

This commit is contained in:
Luxferre
2024-09-15 14:58:30 +03:00
parent 430d67913b
commit 030dfdb956
4 changed files with 7 additions and 4 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ func kk_handle_emotes(text string) string {
re := regexp.MustCompile(regexp.QuoteMeta("[emote:") + "[^:]+:[^" + mbracket + "]+" + mbracket)
text = re.ReplaceAllStringFunc(text, func(emotestr string) string {
parts := strings.Split(emotestr, ":")
return "#KKEMOTE-" + parts[1] + "#"
return " #KKEMOTE-" + parts[1] + "# "
})
return text
}
@@ -126,7 +126,7 @@ func kk_process_message(rawmsg map[string]interface{}) {
if _, ok := metadata["badges"]; ok && len(metadata["badges"].([]interface{})) > 0 {
for _, badge := range metadata["badges"].([]interface{}) {
if badge.(map[string]interface{})["active"].(bool) {
out_message.Type += "-" + badge.(map[string]interface{})["text"].(string)
out_message.Type += "-" + strings.ToLower(badge.(map[string]interface{})["text"].(string))
}
}
}
+3
View File
@@ -10,6 +10,7 @@ import (
"fmt"
"log"
"strings"
"slices"
"encoding/json"
"net/http"
"io/ioutil"
@@ -98,6 +99,8 @@ func sseHandler(w http.ResponseWriter, r *http.Request) {
/* close the channel after exiting the function */
defer func() {
close(transport)
idx := slices.IndexFunc(sse_transports, func(c chan string) bool { return c == transport })
sse_transports[idx] = nil
transport = nil
}()