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"
|
||||
)
|
||||
|
||||
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)
|
||||
resp := utils.NewResponseBuilder(s, i)
|
||||
roles := ""
|
||||
l := len(cfg.XpRoles) - 1
|
||||
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) {
|
||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
||||
func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
// verify every args
|
||||
t, ok := optMap["type"]
|
||||
if !ok {
|
||||
|
@ -209,9 +207,8 @@ func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||
}
|
||||
}
|
||||
|
||||
func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
||||
func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
// verify every args
|
||||
t, ok := optMap["type"]
|
||||
if !ok {
|
||||
|
@ -280,9 +277,8 @@ func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||
}
|
||||
}
|
||||
|
||||
func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
||||
func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
// verify every args
|
||||
salon, ok := optMap["channel"]
|
||||
if !ok {
|
||||
|
@ -322,9 +318,8 @@ func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate)
|
|||
}
|
||||
}
|
||||
|
||||
func ConfigPeriodBeforeReduce(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
optMap := utils.GenerateOptionMapForSubcommand(i)
|
||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
||||
func ConfigPeriodBeforeReduce(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
// verify every args
|
||||
days, ok := optMap["days"]
|
||||
if !ok {
|
||||
|
|
|
@ -5,8 +5,7 @@ import (
|
|||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
resp := utils.NewResponseBuilder(s, i)
|
||||
func Credits(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
err := resp.AddEmbed(&discordgo.MessageEmbed{
|
||||
|
||||
Type: discordgo.EmbedTypeRich,
|
||||
|
@ -16,7 +15,7 @@ func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||
Fields: []*discordgo.MessageEmbedField{
|
||||
{
|
||||
Name: "anhgelus/gokord",
|
||||
Value: "v0.9.0 - MPL 2.0",
|
||||
Value: "v0.10.0 - MPL 2.0",
|
||||
Inline: true,
|
||||
},
|
||||
{
|
||||
|
@ -25,8 +24,8 @@ func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||
Inline: true,
|
||||
},
|
||||
{
|
||||
Name: "redis/go-redis/v9",
|
||||
Value: "v9.8.0 - BSD-2-Clause",
|
||||
Name: "gorm",
|
||||
Value: "v1.30.0 - MIT",
|
||||
Inline: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -8,13 +8,11 @@ import (
|
|||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
optMap := utils.GenerateOptionMap(i)
|
||||
func Rank(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
c := user.GetCopaing(i.Member.User.ID, i.GuildID) // current user = member who used /rank
|
||||
msg := "Votre niveau"
|
||||
m := i.Member
|
||||
var err error
|
||||
resp := utils.NewResponseBuilder(s, i)
|
||||
if v, ok := optMap["copaing"]; ok {
|
||||
u := v.UserValue(s)
|
||||
if u.Bot {
|
||||
|
|
|
@ -7,17 +7,16 @@ import (
|
|||
"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
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
func ResetUser(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
resp := utils.NewResponseBuilder(s, i).IsEphemeral()
|
||||
optMap := utils.GenerateOptionMap(i)
|
||||
func ResetUser(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
v, ok := optMap["user"]
|
||||
if !ok {
|
||||
if err := resp.SetMessage("Le user n'a pas été renseigné.").Send(); err != nil {
|
||||
|
|
|
@ -10,9 +10,8 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
func Top(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
resp := utils.NewResponseBuilder(s, i).IsDeferred()
|
||||
err := resp.Send()
|
||||
func Top(s *discordgo.Session, i *discordgo.InteractionCreate, optMap utils.OptionMap, resp *utils.ResponseBuilder) {
|
||||
err := resp.IsDeferred().Send()
|
||||
if err != nil {
|
||||
utils.SendAlert("commands/top.go - Sending deferred", err.Error())
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue