aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus@anhgelus.world>2025-05-21 17:28:18 +0200
committerAnhgelus Morhtuuzh <anhgelus@anhgelus.world>2025-05-21 17:28:18 +0200
commit642025681befa35f67cc7c25383eb782ac01feac (patch)
tree6c2b1fdb2712300cdd4615de8d8cae06e8b382af /commands
parent24f0db37218c4050e01edaa031410382aa252324 (diff)
build(gokord): upgrade to 0.7.0
Diffstat (limited to 'commands')
-rw-r--r--commands/config.go14
-rw-r--r--commands/credits.go2
-rw-r--r--commands/rank.go2
-rw-r--r--commands/reset.go6
-rw-r--r--commands/top.go5
5 files changed, 11 insertions, 18 deletions
diff --git a/commands/config.go b/commands/config.go
index a3857c6..8df8664 100644
--- a/commands/config.go
+++ b/commands/config.go
@@ -12,7 +12,7 @@ import (
func ConfigShow(s *discordgo.Session, i *discordgo.InteractionCreate) {
cfg := config.GetGuildConfig(i.GuildID)
- resp := utils.ResponseBuilder{C: s, I: i}
+ resp := utils.NewResponseBuilder(s, i)
roles := ""
l := len(cfg.XpRoles) - 1
for i, r := range cfg.XpRoles {
@@ -80,8 +80,7 @@ func ConfigShow(s *discordgo.Session, i *discordgo.InteractionCreate) {
func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate) {
optMap := utils.GenerateOptionMapForSubcommand(i)
- resp := utils.ResponseBuilder{C: s, I: i}
- resp.IsEphemeral()
+ resp := utils.NewResponseBuilder(s, i).IsEphemeral()
// verify every args
t, ok := optMap["type"]
if !ok {
@@ -214,8 +213,7 @@ func ConfigXP(s *discordgo.Session, i *discordgo.InteractionCreate) {
func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
optMap := utils.GenerateOptionMapForSubcommand(i)
- resp := utils.ResponseBuilder{C: s, I: i}
- resp.IsEphemeral()
+ resp := utils.NewResponseBuilder(s, i).IsEphemeral()
// verify every args
t, ok := optMap["type"]
if !ok {
@@ -286,8 +284,7 @@ func ConfigChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate) {
optMap := utils.GenerateOptionMapForSubcommand(i)
- resp := utils.ResponseBuilder{C: s, I: i}
- resp.IsEphemeral()
+ resp := utils.NewResponseBuilder(s, i).IsEphemeral()
// verify every args
salon, ok := optMap["channel"]
if !ok {
@@ -329,8 +326,7 @@ func ConfigFallbackChannel(s *discordgo.Session, i *discordgo.InteractionCreate)
func ConfigPeriodBeforeReduce(s *discordgo.Session, i *discordgo.InteractionCreate) {
optMap := utils.GenerateOptionMapForSubcommand(i)
- resp := utils.ResponseBuilder{C: s, I: i}
- resp.IsEphemeral()
+ resp := utils.NewResponseBuilder(s, i).IsEphemeral()
// verify every args
days, ok := optMap["days"]
if !ok {
diff --git a/commands/credits.go b/commands/credits.go
index d5aa42e..62bbcac 100644
--- a/commands/credits.go
+++ b/commands/credits.go
@@ -6,7 +6,7 @@ import (
)
func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) {
- resp := utils.ResponseBuilder{C: s, I: i}
+ resp := utils.NewResponseBuilder(s, i)
err := resp.Embeds([]*discordgo.MessageEmbed{
{
Type: discordgo.EmbedTypeRich,
diff --git a/commands/rank.go b/commands/rank.go
index 70c0222..d577299 100644
--- a/commands/rank.go
+++ b/commands/rank.go
@@ -14,7 +14,7 @@ func Rank(s *discordgo.Session, i *discordgo.InteractionCreate) {
msg := "Votre niveau"
m := i.Member
var err error
- resp := utils.ResponseBuilder{C: s, I: i}
+ resp := utils.NewResponseBuilder(s, i)
if v, ok := optMap["copaing"]; ok {
u := v.UserValue(s)
if u.Bot {
diff --git a/commands/reset.go b/commands/reset.go
index 3f8af03..20b15ea 100644
--- a/commands/reset.go
+++ b/commands/reset.go
@@ -10,15 +10,13 @@ import (
func Reset(s *discordgo.Session, i *discordgo.InteractionCreate) {
var copaings []*user.Copaing
gokord.DB.Where("guild_id = ?", i.GuildID).Delete(&copaings)
- resp := utils.ResponseBuilder{C: s, I: i}
- if err := resp.IsEphemeral().Message("L'XP a été reset.").Send(); err != nil {
+ if err := utils.NewResponseBuilder(s, i).IsEphemeral().Message("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.ResponseBuilder{C: s, I: i}
- resp.IsEphemeral()
+ resp := utils.NewResponseBuilder(s, i).IsEphemeral()
optMap := utils.GenerateOptionMap(i)
v, ok := optMap["user"]
if !ok {
diff --git a/commands/top.go b/commands/top.go
index 53ccef9..5a20091 100644
--- a/commands/top.go
+++ b/commands/top.go
@@ -11,13 +11,12 @@ import (
)
func Top(s *discordgo.Session, i *discordgo.InteractionCreate) {
- resp := utils.ResponseBuilder{C: s, I: i}
- err := resp.IsDeferred().Send()
+ resp := utils.NewResponseBuilder(s, i).IsDeferred()
+ err := resp.Send()
if err != nil {
utils.SendAlert("commands/top.go - Sending deferred", err.Error())
return
}
- resp.NotDeferred().IsEdit()
embeds := make([]*discordgo.MessageEmbed, 3)
wg := sync.WaitGroup{}