update versions and change to std logger

This commit is contained in:
Seraphim Strub 2023-04-23 00:33:20 +02:00
parent aa20d59a0f
commit df441014ed
17 changed files with 212 additions and 147 deletions

View file

@ -5,6 +5,7 @@ import (
"github.com/disgoorg/disgo/discord"
"github.com/disgoorg/disgo/events"
"grow.rievo.dev/discordBots/cmd/funbot/imgur"
"log"
"strings"
)
@ -32,7 +33,7 @@ func handlerImg(event *events.ApplicationCommandInteractionCreate) {
}
}(value)
if err != nil {
event.Client().Logger().Error("error on getting link: ", err)
log.Printf("ERROR: error on getting link: %v", err)
return
}
@ -40,7 +41,7 @@ func handlerImg(event *events.ApplicationCommandInteractionCreate) {
SetContent(link).
SetEphemeral(false).Build())
if err != nil {
event.Client().Logger().Error("error on sending response: ", err)
log.Printf("ERROR: error on sending response: %v", err)
return
}
}

View file

@ -6,9 +6,9 @@ import (
"github.com/disgoorg/disgo/bot"
"github.com/disgoorg/disgo/cache"
"github.com/disgoorg/disgo/gateway"
"github.com/disgoorg/log"
"grow.rievo.dev/discordBots/cmd/funbot/command"
"grow.rievo.dev/discordBots/cmd/funbot/config"
"log"
"os"
"os/signal"
"strings"
@ -16,9 +16,8 @@ import (
)
func main() {
log.SetLevel(log.LevelInfo)
log.Info("starting funbot...")
log.Info("disgo version: ", disgo.Version)
log.Printf("INFO: starting funbot...")
log.Printf("INFO: disgo version: %v", disgo.Version)
// permissions:
// intent:
@ -51,7 +50,7 @@ func main() {
}
if config.RegisterGuildID != 0 {
if _, err = client.Rest().SetGuildCommands(client.ApplicationID(), config.RegisterGuildID, config.NoCommands); err != nil {
log.Info("error deleting guild commands", err)
log.Printf("INFO: error deleting guild commands %v", err)
}
}
} else {
@ -59,7 +58,7 @@ func main() {
log.Fatal("error while registering commands: ", err)
}
if _, err = client.Rest().SetGlobalCommands(client.ApplicationID(), config.NoCommands); err != nil {
log.Info("error deleting global commands", err)
log.Printf("INFO: error deleting global commands %v", err)
}
}
@ -67,7 +66,7 @@ func main() {
log.Fatal("error while connecting to gateway: ", err)
}
log.Infof("funbot is now running. Press CTRL-C to exit.")
log.Printf("INFO: funbot is now running. Press CTRL-C to exit.")
s := make(chan os.Signal, 1)
signal.Notify(s, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-s