Skip to content

Commit

Permalink
(clean) remove deprecated commands
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinuit committed May 12, 2024
1 parent 6cc974a commit 8386128
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 64 deletions.
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)
}

0 comments on commit 8386128

Please sign in to comment.