mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-04-19 16:01:22 +02:00
- Fixed SLEEPTIME not working (always 0) - Refined logging - Added metadata to /info command - Bot now automatically sets own commands for autocompletion
43 lines
740 B
Go
43 lines
740 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
|
|
"watn3y/steamsalty/config"
|
|
)
|
|
|
|
func main() {
|
|
println("Starting SteamSalty...")
|
|
|
|
configureLogger()
|
|
|
|
config.LoadConfig()
|
|
|
|
bot()
|
|
|
|
}
|
|
|
|
func configureLogger() {
|
|
|
|
zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string {
|
|
const prefix = "steamsalty/"
|
|
|
|
index := strings.Index(file, prefix)
|
|
if index != -1 {
|
|
return file[index+len(prefix):] + ":" + strconv.Itoa(line)
|
|
}
|
|
return file + ":" + strconv.Itoa(line)
|
|
}
|
|
|
|
output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.DateTime}
|
|
|
|
log.Logger = zerolog.New(output).With().Timestamp().Caller().Logger()
|
|
log.Info().Msg("Started Logger")
|
|
|
|
}
|