continued porting to disgo...

This commit is contained in:
2024-04-09 23:21:08 +02:00
parent 01ac1ec363
commit b7f126efba
10 changed files with 284 additions and 379 deletions

View File

@@ -1,25 +1,29 @@
package main
/*
var cmd_cat Command = Command{
Definition: discordgo.ApplicationCommand{
import (
"encoding/json"
"io"
"net/http"
"github.com/disgoorg/disgo/discord"
"github.com/disgoorg/disgo/events"
"github.com/sirupsen/logrus"
)
var cmd_cat = Command{
Definition: discord.SlashCommandCreate{
Name: "cat",
Description: "Random cat pictures",
},
Interact: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
Interact: func(e *events.ApplicationCommandInteractionCreate) {
cat, err := GetCatImageURL()
if err == nil {
err := respondEmbed(i.Interaction, discordgo.MessageEmbed{
Type: discordgo.EmbedTypeImage,
Color: hexToDecimal(color["primary"]),
Image: &discordgo.MessageEmbedImage{
URL: cat,
}}, false)
err = e.CreateMessage(discord.NewMessageCreateBuilder().
AddEmbeds(discord.NewEmbedBuilder().SetImage(cat).SetColor(hexToDecimal(color["primary"])).Build()).
Build())
if err != nil {
logrus.Error(err)
}
} else {
logrus.Error(err)
}
},
AllowDM: true,
@@ -44,4 +48,3 @@ func GetCatImageURL() (string, error) {
return "https://cataas.com/cat/" + images.ID, err
}
*/