forked from SunRed/discord-tweeter
Initial commit
This commit is contained in:
commit
eca46fcadd
21 changed files with 1666 additions and 0 deletions
28
cmd/config.go
Normal file
28
cmd/config.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/BurntSushi/toml"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Username string
|
||||
Password string
|
||||
ProxyAddr string
|
||||
Channels []string
|
||||
Filter []uint8
|
||||
Webhook string
|
||||
DbPath string
|
||||
CookiePath string
|
||||
}
|
||||
|
||||
func ConfigFromFile(filePath string) (conf *Config, err error) {
|
||||
tomlData, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = toml.Decode(string(tomlData), &conf)
|
||||
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue