fixed custom badge fetching

This commit is contained in:
Luxferre
2024-09-21 08:58:50 +03:00
parent dfe8ce583d
commit 3b84bc6c55
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -1,11 +1,11 @@
{ {
"server_port": 60053, "server_port": 60053,
"server_listen_ip": "127.0.0.1", "server_listen_ip": "127.0.0.1",
"debug": true, "debug": false,
"useragent": "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0", "useragent": "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0",
"tw_backend_enabled": true, "tw_backend_enabled": true,
"tw_nickname": "Suborg", "tw_nickname": "Suborg",
"tw_channel": "#suborg", "tw_channel": "#foxyshadow",
"yt_backend_enabled": false, "yt_backend_enabled": false,
"yt_api_poll_timeout": 1, "yt_api_poll_timeout": 1,
"yt_channel": "@foxyshadow", "yt_channel": "@foxyshadow",
+3 -2
View File
@@ -72,7 +72,7 @@ func tw_fetch_badge_cache(channelname string) map[string]string {
broadcaster_id := "" broadcaster_id := ""
var ustruct map[string]interface{} var ustruct map[string]interface{}
/* get broadcaster ID from the channel name */ /* get broadcaster ID from the channel name */
body := tw_api_req(fmt.Sprintf("/users?login=%s", channelname), "") body := tw_api_req("/users?login=" + channelname, "")
if len(body) > 0 { if len(body) > 0 {
err := json.Unmarshal(body, &ustruct) err := json.Unmarshal(body, &ustruct)
if err == nil { if err == nil {
@@ -281,7 +281,8 @@ func twitch_run(config map[string]interface{}) {
TW_OAUTH_TOKEN, _ = strings.CutPrefix(config["tw_token"].(string), "oauth:") TW_OAUTH_TOKEN, _ = strings.CutPrefix(config["tw_token"].(string), "oauth:")
/* load the Twitch badge cache */ /* load the Twitch badge cache */
TW_BADGE_CACHE = tw_fetch_badge_cache(config["tw_channel"].(string)) chname, _ := strings.CutPrefix(config["tw_channel"].(string), "#")
TW_BADGE_CACHE = tw_fetch_badge_cache(chname)
/* Connect to the Twitch IRC server */ /* Connect to the Twitch IRC server */
conn, err := net.Dial("tcp", "irc.chat.twitch.tv:6667") conn, err := net.Dial("tcp", "irc.chat.twitch.tv:6667")