diff --git a/backend/backend.go b/backend/backend.go index 6e430fb..85f5887 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -4,9 +4,10 @@ import ( "net/http" "time" - "github.com/KittyBot-Org/KittyBotGo/db" "github.com/disgoorg/handler" + "github.com/KittyBot-Org/KittyBotGo/db" + "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/rest" "github.com/disgoorg/log" diff --git a/backend/config.go b/backend/config.go index 1e4d822..68dc450 100644 --- a/backend/config.go +++ b/backend/config.go @@ -3,8 +3,9 @@ package backend import ( "time" - "github.com/KittyBot-Org/KittyBotGo/config" "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/config" ) type Config struct { diff --git a/backend/routes/votes.go b/backend/routes/votes.go index 6bc184d..6f513a8 100644 --- a/backend/routes/votes.go +++ b/backend/routes/votes.go @@ -4,9 +4,10 @@ import ( "encoding/json" "net/http" - backend2 "github.com/KittyBot-Org/KittyBotGo/backend" "github.com/disgoorg/snowflake/v2" "github.com/gorilla/mux" + + backend2 "github.com/KittyBot-Org/KittyBotGo/backend" ) type voteAddPayload struct { diff --git a/cmd/backend/main.go b/cmd/backend/main.go index ddc88d9..a0eb682 100644 --- a/cmd/backend/main.go +++ b/cmd/backend/main.go @@ -6,12 +6,13 @@ import ( "os/signal" "syscall" + "github.com/disgoorg/log" + _ "github.com/lib/pq" + backend2 "github.com/KittyBot-Org/KittyBotGo/backend" "github.com/KittyBot-Org/KittyBotGo/backend/routes" "github.com/KittyBot-Org/KittyBotGo/config" "github.com/KittyBot-Org/KittyBotGo/db" - "github.com/disgoorg/log" - _ "github.com/lib/pq" ) var ( diff --git a/cmd/dbot/main.go b/cmd/dbot/main.go index 6290482..1e7f773 100644 --- a/cmd/dbot/main.go +++ b/cmd/dbot/main.go @@ -3,18 +3,22 @@ package main import ( "context" "flag" + "net/http" "os" "os/signal" "syscall" + "github.com/disgoorg/log" + "github.com/disgoorg/snowflake/v2" + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" + _ "github.com/lib/pq" + "github.com/KittyBot-Org/KittyBotGo/config" "github.com/KittyBot-Org/KittyBotGo/db" "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/KittyBot-Org/KittyBotGo/dbot/commands" "github.com/KittyBot-Org/KittyBotGo/dbot/listeners" - "github.com/disgoorg/log" - "github.com/disgoorg/snowflake/v2" - _ "github.com/lib/pq" ) var ( @@ -35,6 +39,15 @@ func main() { logger := log.New(log.Ldate | log.Ltime | log.Lshortfile) logger.Info("Starting discord dbot version: ", version) + go func() { + r := chi.NewRouter() + r.Use(middleware.Logger) + r.Use(middleware.Recoverer) + r.Use(middleware.Heartbeat("/ping")) + r.Mount("/debug", middleware.Profiler()) + log.Error(http.ListenAndServe("0.0.0.0:6060", r)) + }() + var cfg dbot.Config if err := config.LoadConfig(&cfg); err != nil { logger.Fatal("Failed to load config: ", err) diff --git a/config/config.go b/config/config.go index ed0face..143db6c 100644 --- a/config/config.go +++ b/config/config.go @@ -4,10 +4,11 @@ import ( "errors" "os" - "github.com/KittyBot-Org/KittyBotGo/db" "github.com/disgoorg/json" "github.com/disgoorg/log" "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/db" ) func LoadConfig(v interface{}) error { diff --git a/db/guild_settings.go b/db/guild_settings.go index 2466489..ffd4a73 100644 --- a/db/guild_settings.go +++ b/db/guild_settings.go @@ -3,10 +3,11 @@ package db import ( "database/sql" - . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" "github.com/disgoorg/snowflake/v2" . "github.com/go-jet/jet/v2/postgres" + + . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" ) type GuildSettingsDB interface { diff --git a/db/liked_tracks.go b/db/liked_tracks.go index 149050c..f49ec2d 100644 --- a/db/liked_tracks.go +++ b/db/liked_tracks.go @@ -4,10 +4,11 @@ import ( "database/sql" "time" - . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" "github.com/disgoorg/snowflake/v2" . "github.com/go-jet/jet/v2/postgres" + + . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" ) type LikedTracksDB interface { diff --git a/db/play_histories.go b/db/play_histories.go index 878a5d9..8d48479 100644 --- a/db/play_histories.go +++ b/db/play_histories.go @@ -4,10 +4,11 @@ import ( "database/sql" "time" - . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" "github.com/disgoorg/snowflake/v2" . "github.com/go-jet/jet/v2/postgres" + + . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" ) type PlayHistoriesDB interface { diff --git a/db/reports.go b/db/reports.go index 72f8813..67c6bce 100644 --- a/db/reports.go +++ b/db/reports.go @@ -4,10 +4,11 @@ import ( "database/sql" "time" - . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" "github.com/disgoorg/snowflake/v2" . "github.com/go-jet/jet/v2/postgres" + + . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" ) type ReportsDB interface { diff --git a/db/tags.go b/db/tags.go index 4d6a161..c573ae7 100644 --- a/db/tags.go +++ b/db/tags.go @@ -4,10 +4,11 @@ import ( "database/sql" "time" - . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" "github.com/disgoorg/snowflake/v2" . "github.com/go-jet/jet/v2/postgres" + + . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" ) type TagsDB interface { diff --git a/db/voters.go b/db/voters.go index 0b8cac3..fa47a5d 100644 --- a/db/voters.go +++ b/db/voters.go @@ -4,10 +4,11 @@ import ( "database/sql" "time" - . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" "github.com/disgoorg/snowflake/v2" . "github.com/go-jet/jet/v2/postgres" + + . "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/table" ) type VotersDB interface { diff --git a/dbot/bot.go b/dbot/bot.go index 953160a..0b914cf 100644 --- a/dbot/bot.go +++ b/dbot/bot.go @@ -3,7 +3,6 @@ package dbot import ( "context" - "github.com/KittyBot-Org/KittyBotGo/db" "github.com/disgoorg/disgo" "github.com/disgoorg/disgo/bot" "github.com/disgoorg/disgo/cache" @@ -15,6 +14,8 @@ import ( "github.com/disgoorg/log" "github.com/disgoorg/snowflake/v2" "github.com/disgoorg/utils/paginator" + + "github.com/KittyBot-Org/KittyBotGo/db" ) func New(logger log.Logger, config Config, version string) *Bot { @@ -46,7 +47,7 @@ func (b *Bot) SetupBot(listeners ...bot.EventListener) (err error) { bot.WithLogger(b.Logger), bot.WithGatewayConfigOpts(gateway.WithIntents(gateway.IntentGuilds, gateway.IntentGuildVoiceStates, gateway.IntentMessageContent, gateway.IntentAutoModerationExecution)), bot.WithCacheConfigOpts( - cache.WithCacheFlags(cache.FlagVoiceStates, cache.FlagMembers, cache.FlagChannels, cache.FlagGuilds, cache.FlagRoles), + cache.WithCaches(cache.FlagVoiceStates, cache.FlagMembers, cache.FlagChannels, cache.FlagGuilds, cache.FlagRoles), cache.WithMemberCachePolicy(func(member discord.Member) bool { return member.User.ID == b.Client.ID() }), diff --git a/dbot/command_checks.go b/dbot/command_checks.go index 5b23aeb..e54f7dd 100644 --- a/dbot/command_checks.go +++ b/dbot/command_checks.go @@ -70,7 +70,7 @@ func HasHistoryItems(b *Bot) handler.Check[*events.ApplicationCommandInteraction func IsMemberConnectedToVoiceChannel(b *Bot) handler.Check[*events.ApplicationCommandInteractionCreate] { return func(ctx *events.ApplicationCommandInteractionCreate) bool { - if voiceState, ok := ctx.Client().Caches().VoiceStates().Get(*ctx.GuildID(), ctx.User().ID); !ok || voiceState.ChannelID == nil { + if voiceState, ok := ctx.Client().Caches().VoiceState(*ctx.GuildID(), ctx.User().ID); !ok || voiceState.ChannelID == nil { if err := ctx.CreateMessage(discord.MessageCreate{ Content: "You need to be connected to a voice channel to play music.", Flags: discord.MessageFlagEphemeral, diff --git a/dbot/commands/bass-boost.go b/dbot/commands/bass-boost.go index cc976ae..2d8a2ab 100644 --- a/dbot/commands/bass-boost.go +++ b/dbot/commands/bass-boost.go @@ -1,12 +1,13 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/disgolink/lavalink" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) var bassBoost = &lavalink.Equalizer{ diff --git a/dbot/commands/clear-queue.go b/dbot/commands/clear-queue.go index 5da0fd9..13e6356 100644 --- a/dbot/commands/clear-queue.go +++ b/dbot/commands/clear-queue.go @@ -1,10 +1,11 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func ClearQueue(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/history.go b/dbot/commands/history.go index ec78b3d..db88cc1 100644 --- a/dbot/commands/history.go +++ b/dbot/commands/history.go @@ -3,11 +3,12 @@ package commands import ( "fmt" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/utils/paginator" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func History(bot *dbot.Bot) handler.Command { diff --git a/dbot/commands/liked-tracks.go b/dbot/commands/liked-tracks.go index af26b50..eb9754e 100644 --- a/dbot/commands/liked-tracks.go +++ b/dbot/commands/liked-tracks.go @@ -3,13 +3,14 @@ package commands import ( "fmt" - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/utils/paginator" "github.com/lithammer/fuzzysearch/fuzzy" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func LikedTracks(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/loop.go b/dbot/commands/loop.go index 957e42d..057fd79 100644 --- a/dbot/commands/loop.go +++ b/dbot/commands/loop.go @@ -3,10 +3,11 @@ package commands import ( "fmt" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Loop(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/music_player.go b/dbot/commands/music_player.go index 158d0cb..34d7ee9 100644 --- a/dbot/commands/music_player.go +++ b/dbot/commands/music_player.go @@ -1,12 +1,13 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/go-jet/jet/v2/qrm" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func PlayerNext(b *dbot.Bot) handler.Component { diff --git a/dbot/commands/music_utils.go b/dbot/commands/music_utils.go index 7da56fc..809c2ed 100644 --- a/dbot/commands/music_utils.go +++ b/dbot/commands/music_utils.go @@ -3,12 +3,13 @@ package commands import ( "fmt" - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/disgolink/lavalink" source_plugins "github.com/disgoorg/source-plugins" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func getMusicControllerComponents(track lavalink.AudioTrack) discord.ContainerComponent { diff --git a/dbot/commands/next.go b/dbot/commands/next.go index 65a76c2..810bfe0 100644 --- a/dbot/commands/next.go +++ b/dbot/commands/next.go @@ -1,11 +1,12 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Next(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/now-playing.go b/dbot/commands/now-playing.go index 7b9f55a..d45316a 100644 --- a/dbot/commands/now-playing.go +++ b/dbot/commands/now-playing.go @@ -3,11 +3,12 @@ package commands import ( "fmt" - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func NowPlaying(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/pause.go b/dbot/commands/pause.go index bda82f5..84c832a 100644 --- a/dbot/commands/pause.go +++ b/dbot/commands/pause.go @@ -1,11 +1,12 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Pause(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/play.go b/dbot/commands/play.go index efe796f..25fc363 100644 --- a/dbot/commands/play.go +++ b/dbot/commands/play.go @@ -6,8 +6,6 @@ import ( "strconv" "time" - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/bot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" @@ -16,6 +14,9 @@ import ( "github.com/disgoorg/snowflake/v2" source_plugins "github.com/disgoorg/source-plugins" "github.com/lithammer/fuzzysearch/fuzzy" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) var urlPattern = regexp.MustCompile("^https?://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]?") @@ -84,14 +85,14 @@ func playHandler(b *dbot.Bot) handler.CommandHandler { return func(e *events.ApplicationCommandInteractionCreate) error { data := e.SlashCommandInteractionData() - voiceState, ok := b.Client.Caches().VoiceStates().Get(*e.GuildID(), e.User().ID) + voiceState, ok := b.Client.Caches().VoiceState(*e.GuildID(), e.User().ID) if !ok || voiceState.ChannelID == nil { return e.CreateMessage(responses.CreateErrorf("You must be in a voice channel to use this command.")) } - channel, _ := e.Client().Caches().Channels().GetGuildAudioChannel(*voiceState.ChannelID) - selfMember, _ := e.Client().Caches().GetSelfMember(*e.GuildID()) - if perms := b.Client.Caches().GetMemberPermissionsInChannel(channel, selfMember); perms.Missing(discord.PermissionVoiceConnect) { + channel, _ := e.Client().Caches().GuildAudioChannel(*voiceState.ChannelID) + selfMember, _ := e.Client().Caches().SelfMember(*e.GuildID()) + if perms := b.Client.Caches().MemberPermissionsInChannel(channel, selfMember); perms.Missing(discord.PermissionVoiceConnect) { return e.CreateMessage(responses.CreateErrorf("It seems like I don't have permissions to join your voice channel.")) } @@ -112,13 +113,13 @@ func playHandler(b *dbot.Bot) handler.CommandHandler { if err := b.DB.PlayHistory().Add(e.User().ID, query, track.Info().Title); err != nil { b.Logger.Error("Failed to add track to play history: ", err) } - playAndQueue(b, e.BaseInteraction, track) + playAndQueue(b, e, track) }, func(playlist lavalink.AudioPlaylist) { if err := b.DB.PlayHistory().Add(e.User().ID, query, playlist.Name()); err != nil { b.Logger.Error("Failed to add track to play history: ", err) } - playAndQueue(b, e.BaseInteraction, playlist.Tracks()...) + playAndQueue(b, e, playlist.Tracks()...) }, func(tracks []lavalink.AudioTrack) { if err := b.DB.PlayHistory().Add(e.User().ID, query, data.String("query")); err != nil { @@ -221,14 +222,14 @@ func playAutocompleteHandler(b *dbot.Bot) handler.AutocompleteHandler { } } -func playAndQueue(b *dbot.Bot, i discord.BaseInteraction, tracks ...lavalink.AudioTrack) { +func playAndQueue(b *dbot.Bot, i discord.Interaction, tracks ...lavalink.AudioTrack) { player := b.MusicPlayers.Get(*i.GuildID()) if player == nil { player = b.MusicPlayers.New(*i.GuildID(), dbot.PlayerTypeMusic, dbot.LoopingTypeOff) b.MusicPlayers.Add(player) } var voiceChannelID snowflake.ID - if voiceState, ok := b.Client.Caches().VoiceStates().Get(*i.GuildID(), i.User().ID); !ok || voiceState.ChannelID == nil { + if voiceState, ok := b.Client.Caches().VoiceState(*i.GuildID(), i.User().ID); !ok || voiceState.ChannelID == nil { if _, err := b.Client.Rest().UpdateInteractionResponse(i.ApplicationID(), i.Token(), responses.UpdateErrorComponentsf("You need to be in a voice channel.", nil)); err != nil { b.Logger.Error("Failed to update error message: ", err) } @@ -237,8 +238,8 @@ func playAndQueue(b *dbot.Bot, i discord.BaseInteraction, tracks ...lavalink.Aud voiceChannelID = *voiceState.ChannelID } - if voiceState, ok := b.Client.Caches().VoiceStates().Get(*i.GuildID(), b.Client.ID()); !ok || voiceState.ChannelID == nil || *voiceState.ChannelID != voiceChannelID { - if err := b.Client.Connect(context.TODO(), *i.GuildID(), voiceChannelID); err != nil { + if voiceState, ok := b.Client.Caches().VoiceState(*i.GuildID(), b.Client.ID()); !ok || voiceState.ChannelID == nil || *voiceState.ChannelID != voiceChannelID { + if err := b.Client.UpdateVoiceState(context.TODO(), *i.GuildID(), &voiceChannelID, false, false); err != nil { if _, err = b.Client.Rest().UpdateInteractionResponse(i.ApplicationID(), i.Token(), responses.UpdateErrorComponentsf("Failed to connect to your voice channel. Please try again.", nil)); err != nil { b.Logger.Error("Failed to update error message: ", err) } @@ -335,7 +336,7 @@ func giveSearchSelection(b *dbot.Bot, e *events.ApplicationCommandInteractionCre index, _ := strconv.Atoi(value) playTracks = append(playTracks, tracks[index]) } - playAndQueue(b, e.BaseInteraction, playTracks...) + playAndQueue(b, e, playTracks...) return }, func() { diff --git a/dbot/commands/previous.go b/dbot/commands/previous.go index b4994d4..ef1f5a4 100644 --- a/dbot/commands/previous.go +++ b/dbot/commands/previous.go @@ -1,11 +1,12 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Previous(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/queue.go b/dbot/commands/queue.go index b345e08..8be16ba 100644 --- a/dbot/commands/queue.go +++ b/dbot/commands/queue.go @@ -3,11 +3,12 @@ package commands import ( "fmt" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/utils/paginator" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Queue(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/remove.go b/dbot/commands/remove.go index af86bf7..dff7877 100644 --- a/dbot/commands/remove.go +++ b/dbot/commands/remove.go @@ -5,11 +5,12 @@ import ( "strconv" "strings" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/lithammer/fuzzysearch/fuzzy" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Remove(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/report-user.go b/dbot/commands/report-user.go index d96b82a..187e9c0 100644 --- a/dbot/commands/report-user.go +++ b/dbot/commands/report-user.go @@ -4,11 +4,12 @@ import ( "fmt" "time" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/json" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func ReportUser(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/report.go b/dbot/commands/report.go index c93c669..205bf0b 100644 --- a/dbot/commands/report.go +++ b/dbot/commands/report.go @@ -5,12 +5,13 @@ import ( "strconv" "time" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Report(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/report_components.go b/dbot/commands/report_components.go index 3376279..377a542 100644 --- a/dbot/commands/report_components.go +++ b/dbot/commands/report_components.go @@ -7,13 +7,14 @@ import ( "strings" "time" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/disgo/rest" "github.com/disgoorg/handler" "github.com/disgoorg/json" "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func ReportAction(b *dbot.Bot) handler.Component { @@ -201,6 +202,12 @@ func reportActionHandler(b *dbot.Bot) handler.ComponentHandler { value := e.StringSelectMenuInteractionData().Values[0] switch value { case "delete-message": + if e.Member().Permissions.Missing(discord.PermissionManageMessages) { + return e.CreateMessage(discord.MessageCreate{ + Content: "You need the `Manage Messages` permission to use this action.", + Flags: discord.MessageFlagEphemeral, + }) + } if err = b.Client.Rest().DeleteMessage(snowflake.MustParse(report.ChannelID), snowflake.MustParse(report.MessageID), rest.WithReason(reason)); err != nil { b.Logger.Errorf("Failed to delete message: %s", err) content = "Failed to delete message, please reach out to a bot developer." @@ -251,6 +258,12 @@ func reportActionHandler(b *dbot.Bot) handler.ComponentHandler { } case "timeout": + if e.Member().Permissions.Missing(discord.PermissionModerateMembers) { + return e.CreateMessage(discord.MessageCreate{ + Content: "You need the `Moderate Members` permission to use this action.", + Flags: discord.MessageFlagEphemeral, + }) + } return e.CreateModal(discord.ModalCreate{ CustomID: fmt.Sprintf("handler:report-action-confirm:timeout:%s", report.UserID), Title: "Timeout User", @@ -280,6 +293,12 @@ func reportActionHandler(b *dbot.Bot) handler.ComponentHandler { }) case "kick": + if e.Member().Permissions.Missing(discord.PermissionKickMembers) { + return e.CreateMessage(discord.MessageCreate{ + Content: "You need the `Kick Members` permission to use this action.", + Flags: discord.MessageFlagEphemeral, + }) + } return e.CreateModal(discord.ModalCreate{ CustomID: fmt.Sprintf("handler:report-action-confirm:kick:%s", report.UserID), Title: "Kick User", @@ -298,6 +317,12 @@ func reportActionHandler(b *dbot.Bot) handler.ComponentHandler { }) case "ban": + if e.Member().Permissions.Missing(discord.PermissionBanMembers) { + return e.CreateMessage(discord.MessageCreate{ + Content: "You need the `Ban Members` permission to use this action.", + Flags: discord.MessageFlagEphemeral, + }) + } return e.CreateModal(discord.ModalCreate{ CustomID: fmt.Sprintf("handler:report-action-confirm:ban:%s", report.UserID), Title: "Ban User", diff --git a/dbot/commands/reports.go b/dbot/commands/reports.go index 5056d72..f99d420 100644 --- a/dbot/commands/reports.go +++ b/dbot/commands/reports.go @@ -4,12 +4,13 @@ import ( "database/sql" "fmt" - "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/json" + + "github.com/KittyBot-Org/KittyBotGo/db/.gen/kittybot-go/public/model" + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Reports(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/seek.go b/dbot/commands/seek.go index 9b8e303..e4c5708 100644 --- a/dbot/commands/seek.go +++ b/dbot/commands/seek.go @@ -1,13 +1,14 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/disgolink/lavalink" "github.com/disgoorg/handler" "github.com/disgoorg/json" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Seek(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/settings.go b/dbot/commands/settings.go index a990845..fdaa73e 100644 --- a/dbot/commands/settings.go +++ b/dbot/commands/settings.go @@ -1,12 +1,13 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/json" "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Settings(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/shuffle.go b/dbot/commands/shuffle.go index c6240e4..8142c66 100644 --- a/dbot/commands/shuffle.go +++ b/dbot/commands/shuffle.go @@ -1,11 +1,12 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Shuffle(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/stop.go b/dbot/commands/stop.go index 620c1e5..2ad28d8 100644 --- a/dbot/commands/stop.go +++ b/dbot/commands/stop.go @@ -3,10 +3,11 @@ package commands import ( "context" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Stop(b *dbot.Bot) handler.Command { @@ -36,7 +37,7 @@ func stopHandler(b *dbot.Bot) handler.CommandHandler { } return err } - if err := b.Client.Disconnect(context.TODO(), *e.GuildID()); err != nil { + if err := b.Client.UpdateVoiceState(context.TODO(), *e.GuildID(), nil, false, false); err != nil { b.Logger.Error("Failed to disconnect dbot: ", err) err = e.CreateMessage(discord.MessageCreate{ Content: "Failed to disconnect from voice channel. Please try again.", diff --git a/dbot/commands/tag.go b/dbot/commands/tag.go index 43e9a92..2b3420e 100644 --- a/dbot/commands/tag.go +++ b/dbot/commands/tag.go @@ -4,11 +4,12 @@ import ( "fmt" "strings" - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/go-jet/jet/v2/qrm" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Tag(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/tags.go b/dbot/commands/tags.go index 7fcc227..9eb4e0b 100644 --- a/dbot/commands/tags.go +++ b/dbot/commands/tags.go @@ -5,8 +5,6 @@ import ( "strconv" "strings" - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" @@ -14,6 +12,9 @@ import ( "github.com/go-jet/jet/v2/qrm" "github.com/lib/pq" "github.com/lithammer/fuzzysearch/fuzzy" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Tags(b *dbot.Bot) handler.Command { diff --git a/dbot/commands/volume.go b/dbot/commands/volume.go index d937abc..7b3da66 100644 --- a/dbot/commands/volume.go +++ b/dbot/commands/volume.go @@ -1,12 +1,13 @@ package commands import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/responses" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/handler" "github.com/disgoorg/json" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/responses" ) func Volume(bot *dbot.Bot) handler.Command { diff --git a/dbot/config.go b/dbot/config.go index 4c9a793..54b61b9 100644 --- a/dbot/config.go +++ b/dbot/config.go @@ -1,8 +1,9 @@ package dbot import ( - "github.com/KittyBot-Org/KittyBotGo/config" "github.com/disgoorg/disgolink/lavalink" + + "github.com/KittyBot-Org/KittyBotGo/config" ) type Config struct { diff --git a/dbot/listeners/metrics.go b/dbot/listeners/metrics.go index d291992..2736217 100644 --- a/dbot/listeners/metrics.go +++ b/dbot/listeners/metrics.go @@ -1,10 +1,12 @@ package listeners import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/metrics" "github.com/disgoorg/disgo/bot" + "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/metrics" ) func Metrics(b *dbot.Bot) bot.EventListener { @@ -12,7 +14,12 @@ func Metrics(b *dbot.Bot) bot.EventListener { switch e := event.(type) { case *events.GuildsReady: b.Logger.Info("Guilds ready, setting counter") - metrics.GuildCounter.Set(float64(len(e.Client().Caches().Guilds().All()))) + + var count float64 + e.Client().Caches().GuildsForEach(func(guild discord.Guild) { + count++ + }) + metrics.GuildCounter.Set(count) case *events.GuildJoin: metrics.GuildCounter.Inc() diff --git a/dbot/listeners/moderation.go b/dbot/listeners/moderation.go index 3d45a89..c904b7a 100644 --- a/dbot/listeners/moderation.go +++ b/dbot/listeners/moderation.go @@ -4,13 +4,14 @@ import ( "fmt" "time" - "github.com/KittyBot-Org/KittyBotGo/dbot" - "github.com/KittyBot-Org/KittyBotGo/dbot/commands" "github.com/disgoorg/disgo/bot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" "github.com/disgoorg/json" "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/dbot" + "github.com/KittyBot-Org/KittyBotGo/dbot/commands" ) func Moderation(b *dbot.Bot) bot.EventListener { diff --git a/dbot/listeners/music.go b/dbot/listeners/music.go index 25594f2..66ba5a7 100644 --- a/dbot/listeners/music.go +++ b/dbot/listeners/music.go @@ -1,11 +1,11 @@ package listeners import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/bot" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" - "github.com/disgoorg/snowflake/v2" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Music(b *dbot.Bot) bot.EventListener { @@ -22,10 +22,13 @@ func Music(b *dbot.Bot) bot.EventListener { return } if e.VoiceState.ChannelID == nil && e.OldVoiceState.ChannelID != nil { - botVoiceState, ok := b.Client.Caches().VoiceStates().Get(e.VoiceState.GuildID, e.Client().ID()) + botVoiceState, ok := b.Client.Caches().VoiceState(e.VoiceState.GuildID, e.Client().ID()) if ok && botVoiceState.ChannelID != nil && *botVoiceState.ChannelID == *e.OldVoiceState.ChannelID { - voiceStates := e.Client().Caches().VoiceStates().FindAll(func(groupID snowflake.ID, voiceState discord.VoiceState) bool { - return voiceState.ChannelID != nil && *voiceState.ChannelID == *botVoiceState.ChannelID + var voiceStates []discord.VoiceState + e.Client().Caches().VoiceStatesForEach(e.VoiceState.GuildID, func(voiceState discord.VoiceState) { + if voiceState.ChannelID != nil && *voiceState.ChannelID == *botVoiceState.ChannelID { + voiceStates = append(voiceStates, voiceState) + } }) if len(voiceStates) == 0 { go player.PlanDisconnect() diff --git a/dbot/listeners/settings.go b/dbot/listeners/settings.go index de69bf0..fe656d4 100644 --- a/dbot/listeners/settings.go +++ b/dbot/listeners/settings.go @@ -1,9 +1,10 @@ package listeners import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/disgo/bot" "github.com/disgoorg/disgo/events" + + "github.com/KittyBot-Org/KittyBotGo/dbot" ) func Settings(b *dbot.Bot) bot.EventListener { diff --git a/dbot/metrics/metrics.go b/dbot/metrics/metrics.go index 61c1b88..9171fbf 100644 --- a/dbot/metrics/metrics.go +++ b/dbot/metrics/metrics.go @@ -1,9 +1,10 @@ package metrics import ( - "github.com/KittyBot-Org/KittyBotGo/dbot" "github.com/disgoorg/log" + "github.com/KittyBot-Org/KittyBotGo/dbot" + "net/http" "github.com/prometheus/client_golang/prometheus" diff --git a/dbot/music_player.go b/dbot/music_player.go index 093b43f..2dd9e13 100644 --- a/dbot/music_player.go +++ b/dbot/music_player.go @@ -84,7 +84,7 @@ func (p *MusicPlayer) PlanDisconnect() { <-ctx.Done() if ctx.Err() == context.DeadlineExceeded { - if err := p.Bot.Client.Disconnect(context.TODO(), p.GuildID()); err != nil { + if err := p.Bot.Client.UpdateVoiceState(context.TODO(), p.GuildID(), nil, false, false); err != nil { p.Bot.Logger.Error("Failed to disconnect from voice channel: ", err) } } diff --git a/go.mod b/go.mod index 83d3579..536129f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/KittyBot-Org/KittyBotGo go 1.18 require ( - github.com/disgoorg/disgo v0.14.1-0.20221217000909-728480f0d5fc + github.com/disgoorg/disgo v0.15.2 github.com/disgoorg/disgolink/disgolink v1.7.4 github.com/disgoorg/disgolink/lavalink v1.7.3 github.com/disgoorg/handler v0.3.0 @@ -12,6 +12,7 @@ require ( github.com/disgoorg/snowflake/v2 v2.0.1 github.com/disgoorg/source-plugins v1.3.1-0.20221009162536-28cea64ea737 github.com/disgoorg/utils/paginator v0.0.0-20220811191046-2474e390fa3b + github.com/go-chi/chi/v5 v5.0.8 github.com/go-jet/jet/v2 v2.9.0 github.com/gorilla/mux v1.8.0 github.com/lib/pq v1.10.7 @@ -36,10 +37,11 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b // indirect - github.com/stretchr/testify v1.8.1 // indirect - golang.org/x/exp v0.0.0-20221114191408-850992195362 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/text v0.4.0 // indirect + github.com/stretchr/testify v1.8.2 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 54950a1..dd20f3d 100644 --- a/go.sum +++ b/go.sum @@ -59,8 +59,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/disgoorg/disgo v0.14.1-0.20221217000909-728480f0d5fc h1:h+Hmx0gCVltfaYMibybuobJ1nW/lEnDQy/dLnJOhmx8= -github.com/disgoorg/disgo v0.14.1-0.20221217000909-728480f0d5fc/go.mod h1:YiVpXSmyXLRalYQHTHUFWEQvolCNzw0zh6nfug07b/M= +github.com/disgoorg/disgo v0.15.2 h1:cmdMCHBL17GgkYOJl6d2Btc3MbQiIdzwF6D8lwdJ7L8= +github.com/disgoorg/disgo v0.15.2/go.mod h1:hUkznOmm+f+owh/MuOBX0sDviQV5cL0FqcWbpIyV1Y0= github.com/disgoorg/disgolink/disgolink v1.7.4 h1:JqiB9fOMxEZHktfHc0LZVOCiNLVmkmtlIic8qDTd5W0= github.com/disgoorg/disgolink/disgolink v1.7.4/go.mod h1:qbYYCPJvmoBSxDnk+UznKRYa86QMsIZKQxfv9joBVr4= github.com/disgoorg/disgolink/lavalink v1.7.3 h1:i3wThR0CWWvabhR/HSYM8b6Ln7Ex3ZgX6Hs4VZ+ZSV0= @@ -82,6 +82,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/friendsofgo/errors v0.9.2/go.mod h1:yCvFW5AkDIL9qn7suHVLiI/gH228n7PC4Pn44IGoTOI= +github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= +github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -313,8 +315,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/volatiletech/inflect v0.0.1/go.mod h1:IBti31tG6phkHitLlr5j7shC5SOo//x0AjDzaJU1PLA= github.com/volatiletech/null/v8 v8.1.2/go.mod h1:98DbwNoKEpRrYtGjWFctievIfm4n4MxG0A6EBUcoS5g= github.com/volatiletech/randomize v0.0.1/go.mod h1:GN3U0QYqfZ9FOJ67bzax1cqZ5q2xuj2mXrXBjWaRTlY= @@ -350,6 +352,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -360,8 +364,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ= -golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= +golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -414,8 +418,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -476,8 +480,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -489,8 +493,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=