Compare commits
No commits in common. "91b0e21b7ac29d11d7c6774c92c99f4640a1a8d1" and "e300f7137055a260c522fe546a75e528533cf812" have entirely different histories.
91b0e21b7a
...
e300f71370
@ -1,5 +1,4 @@
|
||||
watbot:
|
||||
database: wat.db # wat.db (in the working directory) is the default
|
||||
server:
|
||||
host: irc.casa # mandatory, no default
|
||||
port: 6697
|
||||
|
2
main.go
2
main.go
@ -20,7 +20,6 @@ type Config struct {
|
||||
}
|
||||
|
||||
type watConfig struct {
|
||||
Database string `default:"wat.db" yaml:"database"`
|
||||
Nick string `yaml:"nick"`
|
||||
Pass string `yaml:"pass"`
|
||||
User string `yaml:"user"`
|
||||
@ -100,7 +99,6 @@ func main() {
|
||||
Name: config.Name,
|
||||
}
|
||||
watConfig := wat.WatConfig{
|
||||
DatabasePath: config.Database,
|
||||
AutoJoinChannels: config.Channels.Join,
|
||||
PermittedChannels: config.Channels.Permitted,
|
||||
IgnoredHosts: config.Ignores.Hosts,
|
||||
|
@ -20,7 +20,6 @@ type WatBot struct {
|
||||
}
|
||||
|
||||
type WatConfig struct {
|
||||
DatabasePath string
|
||||
BotHosts []string
|
||||
BotGames BotGameConfig
|
||||
AdminHosts []string
|
||||
@ -31,7 +30,7 @@ type WatConfig struct {
|
||||
|
||||
func NewWatBot(config *irc.ClientConfig, watConfig *WatConfig, serverConn *tls.Conn) *WatBot {
|
||||
wat := WatBot{conn: serverConn, Nick: config.Nick, c: watConfig}
|
||||
wat.Db = NewWatDb(watConfig.DatabasePath)
|
||||
wat.Db = NewWatDb()
|
||||
wat.game = NewWatGame(&wat, wat.Db)
|
||||
wat.integration = NewWatIntegration(&wat, wat.Db, &WatIntegrationConfig{BotHosts: watConfig.BotHosts, BotGames: watConfig.BotGames})
|
||||
config.Handler = irc.HandlerFunc(wat.HandleIrcMsg)
|
||||
|
@ -52,10 +52,10 @@ type WatDb struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewWatDb(dbpath string) *WatDb {
|
||||
func NewWatDb() *WatDb {
|
||||
w := WatDb{}
|
||||
var err error
|
||||
w.db, err = gorm.Open(sqlite.Open(dbpath), &gorm.Config{})
|
||||
w.db, err = gorm.Open(sqlite.Open("wat.db"), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user