From 55c9a2a75f4b38591428b613a88d3e1caba9c68a Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Thu, 18 Apr 2024 12:43:12 +0200 Subject: [PATCH] feat(commands): credits #2 --- commands/credits.go | 58 +++++++++++++++++++++++++++++++++++++++++++++ main.go | 5 ++++ 2 files changed, 63 insertions(+) create mode 100644 commands/credits.go diff --git a/commands/credits.go b/commands/credits.go new file mode 100644 index 0000000..fb26530 --- /dev/null +++ b/commands/credits.go @@ -0,0 +1,58 @@ +package commands + +import ( + "github.com/anhgelus/gokord/utils" + "github.com/bwmarrin/discordgo" +) + +func Credits(s *discordgo.Session, i *discordgo.InteractionCreate) { + resp := utils.ResponseBuilder{C: s, I: i} + err := resp.Embeds([]*discordgo.MessageEmbed{ + { + Type: discordgo.EmbedTypeRich, + Title: "Crédits", + Description: "Auteur du bot : @anhgelus (https://github.com/anhgelus)\nLangage : Go 1.22\nLicence : AGPLv3", + Color: utils.Success, + Fields: []*discordgo.MessageEmbedField{ + { + Name: "anhgelus/gokord", + Value: "v0.3.0 - MPL 2.0", + Inline: true, + }, + { + Name: "bwmarrin/discordgo", + Value: "v0.28.1 - BSD-3-Clause", + Inline: true, + }, + { + Name: "pelletier/go-toml/v2", + Value: "v2.2.1 - MIT", + Inline: true, + }, + { + Name: "redis/go-redis/v9", + Value: "v9.5.1 - BSD-2-Clause", + Inline: true, + }, + { + Name: "gorm.io/gorm", + Value: "v1.25.9 - MIT", + Inline: true, + }, + { + Name: "gorm.io/driver/postgres", + Value: "v1.5.7 - MIT", + Inline: true, + }, + { + Name: "other", + Value: "Et leurs dépendances !", + Inline: true, + }, + }, + }, + }).Send() + if err != nil { + utils.SendAlert("commands/credits.go - Sending credits", err.Error(), "guild_id", i.GuildID) + } +} diff --git a/main.go b/main.go index 54b3281..9ba35f5 100644 --- a/main.go +++ b/main.go @@ -115,6 +115,10 @@ func main() { SetHandler(commands.ResetUser). SetPermission(gokord.AdminPermission) + creditsCmd := gokord.NewCommand("credits", "Crédits"). + HasOption(). + SetHandler(commands.Credits) + bot := gokord.Bot{ Token: token, Status: []*gokord.Status{ @@ -140,6 +144,7 @@ func main() { topCmd, resetCmd, resetUserCmd, + creditsCmd, }, AfterInit: afterInit, }