fixed path resolution

This commit is contained in:
Luxferre
2024-09-19 15:51:46 +03:00
parent e545d2c1a8
commit 51f28a6397
5 changed files with 22 additions and 8 deletions
+3 -2
View File
@@ -14,6 +14,7 @@ import (
"time"
"net"
"io/ioutil"
"path/filepath"
"unicode/utf8"
)
@@ -143,11 +144,11 @@ func tw_process_message(rawmsg string) {
/* entry point */
func twitch_run(config map[string]interface{}) {
token_path := "auth/twitch-token.txt"
token_path := filepath.Join(APP_ROOT_DIR, "auth", "twitch-token.txt")
token, err := ioutil.ReadFile(token_path)
token_err_msg := "[twitch] No Twitch token file provided or it is empty. "
token_err_msg += "Please visit https://twitchapps.com/tmi/, generate a token there "
token_err_msg += "and paste it into the auth/twitch-token.txt file!"
token_err_msg += "and paste it into the " + token_path +" file!"
if err != nil {
log.Fatal(token_err_msg + "\nDetailed error: ", err)
}