Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated commands #26

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions cmd/shibesbot/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ var (
},
},
},
{
Name: "swalls",
Description: "Returns a wallpaper with a Shiba ina !",
},
{
Name: "sgifs",
Description: "Returns a gif with a Shiba ina !"},
{
Name: "shelp",
Description: "Returns helper",
Expand Down Expand Up @@ -92,8 +85,6 @@ func (sb *Shibesbot) commandPicker(s *discordgo.Session, i *discordgo.Interactio
switch i.ApplicationCommandData().Name {
case "shibes":
response = sb.getShibes()
case "sgifs":
response = getShibesGifs()
case "shelp":
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Expand All @@ -104,19 +95,14 @@ func (sb *Shibesbot) commandPicker(s *discordgo.Session, i *discordgo.Interactio
if err != nil {
sb.log.Error("could not answer to user help command: ", err.Error())
}
return
case "swalls":
response = getShibesWallpaper()
}

err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
if err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: response,
},
})

if err != nil {
}); err != nil {
sb.log.Error("could not answer to user help command: ", err.Error())
return
}
Expand Down
50 changes: 2 additions & 48 deletions cmd/shibesbot/dogequests.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package main

import (
"math/rand"
"net/http"

"github.com/ivolo/go-giphy"

"encoding/json"

"github.com/bwmarrin/discordgo"
Expand All @@ -15,41 +12,14 @@ var (
Shibes ShibesData
)

type WallpaperData struct {
Id int
Width int
Height int
Url_Image string
}

type AlphacodersData struct {
Success bool
Wallpapers []WallpaperData
Total_Match int
}

type ShibesPictures struct {
Shibes []string
Total int
Cursor int
}

type ShibesGifs struct {
Shibes []giphy.Gif
Total int
Cursor int
}

type ShibesWallpapers struct {
Shibes []WallpaperData
Total int
Cursor int
}

type ShibesData struct {
Images ShibesPictures
Gifs ShibesGifs
Wallpapers ShibesWallpapers
Images ShibesPictures
}

func (sb *Shibesbot) getShibes() string {
Expand Down Expand Up @@ -85,27 +55,11 @@ func getHelp() *discordgo.MessageEmbed {
{
Name: "Available commands",
Value: "- *shibes* to get a random shibe !\n" +
"- *sgifs* to get a random gif of shiba !\n" +
"- *shelp* to get help\n" +
"- *swalls* to get an amazing shibe wallpaper",
"- *shelp* to get help",
Inline: false,
},
},
Title: "Hello shibes !",
}
return test
}

func getShibesGifs() string {
if Shibes.Gifs.Total <= 0 {
return "no gifs available, sorry. :("
}
return Shibes.Gifs.Shibes[rand.Int()%Shibes.Gifs.Total].URL
}

func getShibesWallpaper() string {
if Shibes.Wallpapers.Total <= 0 {
return "no wallpapers available, sorry. :("
}
return string(Shibes.Wallpapers.Shibes[rand.Int()%Shibes.Wallpapers.Total].Url_Image)
}
Loading