mirror of
https://github.com/ChuckNorrison/LightningTipBot.git
synced 2026-08-13 12:33:14 +02:00
41 lines
984 B
Go
41 lines
984 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"runtime/debug"
|
|
|
|
"github.com/LightningTipBot/LightningTipBot/internal/lnbits/webhook"
|
|
"github.com/LightningTipBot/LightningTipBot/internal/lnurl"
|
|
"github.com/LightningTipBot/LightningTipBot/internal/price"
|
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram"
|
|
log "github.com/sirupsen/logrus"
|
|
_ "net/http/pprof"
|
|
)
|
|
|
|
// setLogger will initialize the log format
|
|
func setLogger() {
|
|
log.SetLevel(log.TraceLevel)
|
|
customFormatter := new(log.TextFormatter)
|
|
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
|
|
customFormatter.FullTimestamp = true
|
|
log.SetFormatter(customFormatter)
|
|
}
|
|
|
|
func main() {
|
|
// set logger
|
|
setLogger()
|
|
go http.ListenAndServe("0.0.0.0:6060", nil)
|
|
defer withRecovery()
|
|
bot := telegram.NewBot()
|
|
webhook.NewServer(&bot)
|
|
lnurl.NewServer(&bot)
|
|
price.NewPriceWatcher().Start()
|
|
bot.Start()
|
|
}
|
|
|
|
func withRecovery() {
|
|
if r := recover(); r != nil {
|
|
log.Errorln("Recovered panic: ", r)
|
|
debug.PrintStack()
|
|
}
|
|
}
|