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

@ -2,13 +2,12 @@ package main
import (
"context"
"fmt"
"github.com/disgoorg/disgo"
"github.com/disgoorg/disgo/bot"
"github.com/disgoorg/disgo/cache"
"github.com/disgoorg/disgo/discord"
"github.com/disgoorg/disgo/gateway"
"github.com/disgoorg/log"
"log"
"os"
)
@ -19,9 +18,8 @@ var (
// this bot should in theory delete all registered commands for a certain bot
func main() {
log.SetLevel(log.LevelDebug)
log.Info("starting delcombot...")
log.Info("disgo version: ", disgo.Version)
log.Printf("INFO: starting delcombot...")
log.Printf("INFO: disgo version: %v", disgo.Version)
// permissions:
// intent:
@ -44,17 +42,17 @@ func main() {
client.Caches().GuildsForEach(func(guild discord.Guild) {
if _, err = client.Rest().SetGuildCommands(client.ApplicationID(), guild.ID, noCommands); err != nil {
log.Info(fmt.Sprintf("error deleting guild commands from %v: ", guild.Name), err)
log.Printf("INFO: error deleting guild commands from %v: %v", guild.Name, err)
}
})
if _, err = client.Rest().SetGlobalCommands(client.ApplicationID(), noCommands); err != nil {
log.Info("error deleting global commands", err)
log.Printf("INFO: error deleting global commands %v", err)
}
if err = client.OpenGateway(context.TODO()); err != nil {
log.Fatal("error while connecting to gateway: ", err)
}
log.Infof("delcombot removed all guild and global commands")
log.Printf("INFO: delcombot removed all guild and global commands")
}