Commit f7879bc013
Unsigned
Layout: unified · split
internal/curd.go +13 −15
| @@ -3,26 +3,24 @@ package internal | ||
| 3 | 3 | import ( |
| 4 | 4 | "encoding/json" |
| 5 | 5 | "fmt" |
| 6 | "io/ioutil" | |
| 6 | 7 | "os" |
| 7 | 8 | "runtime" |
| 9 | "strings" | |
| 8 | 10 | "time" |
| 9 | // "log" | |
| 10 | 11 | ) |
| 11 | 12 | |
| 12 | type curdConfig struct { | |
| 13 | player string | |
| 14 | historyFile string | |
| 15 | subs_language string | |
| 16 | sub_or_dub string | |
| 17 | percentageToMarkComplete int | |
| 18 | nextEpisodePrompt bool | |
| 19 | skipOp bool | |
| 20 | skipEd bool | |
| 21 | skipFiller bool | |
| 22 | skipRecap bool | |
| 23 | scoreOnCompletion bool | |
| 24 | saveMpvSpeed bool | |
| 25 | discordPresence bool | |
| 13 | func GetTokenFromFile(filePath string) (string, error) { | |
| 14 | // Read the token from the file | |
| 15 | data, err := ioutil.ReadFile(filePath) | |
| 16 | if err != nil { | |
| 17 | return "", fmt.Errorf("failed to read token from file: %w", err) | |
| 18 | } | |
| 19 | ||
| 20 | // Convert the byte slice to a string and remove any surrounding whitespace or newlines | |
| 21 | token := strings.TrimSpace(string(data)) | |
| 22 | ||
| 23 | return token, nil | |
| 26 | 24 | } |
| 27 | 25 | |
| 28 | 26 | // LogData logs the input data into a specified log file with the format [LOG] time lineNumber: logData |