build(gokord): upgrade to 0.10.0
This commit is contained in:
parent
b92911fb6c
commit
48eb4410ad
7 changed files with 23 additions and 31 deletions
|
@ -10,9 +10,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ConfigShow(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func ConfigShow(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
cfg := config.GetGuildConfig(i.GuildID)
|
cfg := config.GetGuildConfig(i.GuildID)
|
||||||
resp := utils.NewResponseBuilder(s, i)
|
|
||||||
roles := ""
|
roles := ""
|
||||||
l := len(cfg.XpRoles) - 1
|
l := len(cfg.XpRoles) - 1
|
||||||
for i, r := range cfg.XpRoles {
|
for i, r := range cfg.XpRoles {
|
||||||
|
@ -76,9 +75,8 @@ func ConfigShow(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
resp.IsEphemeral()
|
||||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
|
||||||
// verify every args
|
// verify every args
|
||||||
t, ok := optMap["type"]
|
t, ok := optMap["type"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -209,9 +207,8 @@ func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
resp.IsEphemeral()
|
||||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
|
||||||
// verify every args
|
// verify every args
|
||||||
t, ok := optMap["type"]
|
t, ok := optMap["type"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -280,9 +277,8 @@ func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
resp.IsEphemeral()
|
||||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
|
||||||
// verify every args
|
// verify every args
|
||||||
salon, ok := optMap["channel"]
|
salon, ok := optMap["channel"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -322,9 +318,8 @@ func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigPeriodBeforeReduce(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func ConfigPeriodBeforeReduce(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
resp.IsEphemeral()
|
||||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
|
||||||
// verify every args
|
// verify every args
|
||||||
days, ok := optMap["days"]
|
days, ok := optMap["days"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -5,8 +5,7 @@ import (
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func Credits(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
resp := utils.NewResponseBuilder(s, i)
|
|
||||||
err := resp.AddEmbed(&discordgo.MessageEmbed{
|
err := resp.AddEmbed(&discordgo.MessageEmbed{
|
||||||
|
|
||||||
Type: discordgo.EmbedTypeRich,
|
Type: discordgo.EmbedTypeRich,
|
||||||
|
@ -16,7 +15,7 @@ func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
Fields: []*discordgo.MessageEmbedField{
|
Fields: []*discordgo.MessageEmbedField{
|
||||||
{
|
{
|
||||||
Name: "anhgelus/gokord",
|
Name: "anhgelus/gokord",
|
||||||
Value: "v0.9.0 - MPL 2.0",
|
Value: "v0.10.0 - MPL 2.0",
|
||||||
Inline: true,
|
Inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -25,8 +24,8 @@ func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
Inline: true,
|
Inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "redis/go-redis/v9",
|
Name: "gorm",
|
||||||
Value: "v9.8.0 - BSD-2-Clause",
|
Value: "v1.30.0 - MIT",
|
||||||
Inline: true,
|
Inline: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,13 +8,11 @@ import (
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func Rank(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
optMap := utils.GenerateOptionMap(i)
|
|
||||||
c := user.GetCopaing(i.Member.User.ID, i.GuildID) // current user = member who used /rank
|
c := user.GetCopaing(i.Member.User.ID, i.GuildID) // current user = member who used /rank
|
||||||
msg := "Votre niveau"
|
msg := "Votre niveau"
|
||||||
m := i.Member
|
m := i.Member
|
||||||
var err error
|
var err error
|
||||||
resp := utils.NewResponseBuilder(s, i)
|
|
||||||
if v, ok := optMap["copaing"]; ok {
|
if v, ok := optMap["copaing"]; ok {
|
||||||
u := v.UserValue(s)
|
u := v.UserValue(s)
|
||||||
if u.Bot {
|
if u.Bot {
|
||||||
|
|
|
@ -7,17 +7,16 @@ import (
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Reset(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func Reset(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
var copaings []*user.Copaing
|
var copaings []*user.Copaing
|
||||||
gokord.DB.Where("guild_id = ?", i.GuildID).Delete(&copaings)
|
gokord.DB.Where("guild_id = ?", i.GuildID).Delete(&copaings)
|
||||||
if err := utils.NewResponseBuilder(s, i).IsEphemeral().SetMessage("L'XP a été reset.").Send(); err != nil {
|
if err := resp.IsEphemeral().SetMessage("L'XP a été reset.").Send(); err != nil {
|
||||||
utils.SendAlert("commands/reset.go - Sending success (all)", err.Error())
|
utils.SendAlert("commands/reset.go - Sending success (all)", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResetUser(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func ResetUser(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
resp.IsEphemeral()
|
||||||
optMap := utils.GenerateOptionMap(i)
|
|
||||||
v, ok := optMap["user"]
|
v, ok := optMap["user"]
|
||||||
if !ok {
|
if !ok {
|
||||||
if err := resp.SetMessage("Le user n'a pas été renseigné.").Send(); err != nil {
|
if err := resp.SetMessage("Le user n'a pas été renseigné.").Send(); err != nil {
|
||||||
|
|
|
@ -10,9 +10,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Top(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func Top(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||||
resp := utils.NewResponseBuilder(s, i).IsDeferred()
|
err := resp.IsDeferred().Send()
|
||||||
err := resp.Send()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.SendAlert("commands/top.go - Sending deferred", err.Error())
|
utils.SendAlert("commands/top.go - Sending deferred", err.Error())
|
||||||
return
|
return
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/anhgelus/les-copaings-bot
|
||||||
go 1.24
|
go 1.24
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/anhgelus/gokord v0.9.0
|
github.com/anhgelus/gokord v0.10.0
|
||||||
github.com/bwmarrin/discordgo v0.29.0
|
github.com/bwmarrin/discordgo v0.29.0
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4
|
github.com/pelletier/go-toml/v2 v2.2.4
|
||||||
gorm.io/driver/postgres v1.5.11
|
gorm.io/driver/postgres v1.5.11
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -2,6 +2,8 @@ github.com/anhgelus/gokord v0.7.0 h1:G9GrxD3/xEreXsiz3etKxbeHsNHrwT5I/VEKSWpyrj4
|
||||||
github.com/anhgelus/gokord v0.7.0/go.mod h1:SfGKyMMGjNS9F9ehiEb5Cc58P+uoDdLDGGYqXSiMCus=
|
github.com/anhgelus/gokord v0.7.0/go.mod h1:SfGKyMMGjNS9F9ehiEb5Cc58P+uoDdLDGGYqXSiMCus=
|
||||||
github.com/anhgelus/gokord v0.9.0 h1:vz7jHZ6papdt/xehe+nx4DxOLquPO6QukW8UzH81bGY=
|
github.com/anhgelus/gokord v0.9.0 h1:vz7jHZ6papdt/xehe+nx4DxOLquPO6QukW8UzH81bGY=
|
||||||
github.com/anhgelus/gokord v0.9.0/go.mod h1:NSepHjTV61LUnuyGgHxEhZNMnWREErGFyOtRYPgdx/E=
|
github.com/anhgelus/gokord v0.9.0/go.mod h1:NSepHjTV61LUnuyGgHxEhZNMnWREErGFyOtRYPgdx/E=
|
||||||
|
github.com/anhgelus/gokord v0.10.0 h1:FaaMWntaezmSCvarcSMjfWr5OXVVwwzlDMnNX8gXaWE=
|
||||||
|
github.com/anhgelus/gokord v0.10.0/go.mod h1:NSepHjTV61LUnuyGgHxEhZNMnWREErGFyOtRYPgdx/E=
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue