telegram-furryimgbot/bot.go

41 lines
852 B
Go
Raw Permalink Normal View History

2017-12-26 09:57:08 +01:00
package main
import (
"github.com/Syfaro/finch"
2018-10-09 09:18:48 +02:00
"github.com/go-telegram-bot-api/telegram-bot-api/v5"
2018-10-05 02:16:19 +02:00
"github.com/sirupsen/logrus"
2018-09-17 00:35:20 +02:00
"huefox.com/syfaro/telegram-furryimgbot/logger"
"huefox.com/syfaro/telegram-furryimgbot/sites"
2018-08-05 08:47:32 +02:00
_ "huefox.com/syfaro/telegram-furryimgbot/commands/info"
2018-08-05 08:29:09 +02:00
_ "huefox.com/syfaro/telegram-furryimgbot/commands/inline"
_ "huefox.com/syfaro/telegram-furryimgbot/commands/message"
_ "huefox.com/syfaro/telegram-furryimgbot/commands/source"
2017-12-26 09:57:08 +01:00
)
func main() {
2018-10-05 02:16:19 +02:00
f := finch.NewFinch("")
switch v := f.Config.Get("debug").(type) {
case bool:
f.API.Debug = v
case string:
f.API.Debug = v == "true"
default:
f.API.Debug = false
}
if f.API.Debug {
2018-10-05 02:16:19 +02:00
logger.Log.SetLevel(logrus.DebugLevel)
} else {
2018-10-05 02:16:19 +02:00
logger.Log.SetLevel(logrus.InfoLevel)
}
2018-09-22 04:07:51 +02:00
2018-10-09 09:18:48 +02:00
tgbotapi.SetLogger(logger.Log)
2018-09-22 04:07:51 +02:00
sites.ConfigureSites(f)
2018-09-16 22:54:09 +02:00
2017-12-26 09:57:08 +01:00
f.Start()
}