Changed pepe function

This commit is contained in:
DutchEllie 2021-09-08 22:35:03 +02:00
parent d6d8eb01f3
commit cd788bab4a

View File

@ -3,10 +3,8 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io"
"math/rand"
"net/http" "net/http"
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -15,7 +13,7 @@ import (
) )
func (app *application) getPepeLink() (string, error) { func (app *application) getPepeLink() (string, error) {
resp, err := http.Get("http://bbwroller.com/random") /*resp, err := http.Get("http://bbwroller.com/random")
if err != nil { if err != nil {
return "", err return "", err
} }
@ -33,9 +31,22 @@ func (app *application) getPepeLink() (string, error) {
} }
randomIndex := rand.Intn(35) randomIndex := rand.Intn(35)
url := "https://bbwroller.com" url := "https://bbwroller.com"
url += pepes[randomIndex] url += pepes[randomIndex]*/
return url, nil // The above function is old and useless. The website bbwroller.com is down
// o7
resp, err := http.Get(app.pepeServer + "/pepe")
if err != nil {
return "", err
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
} }
func (app *application) sendPepe(s *discordgo.Session, m *discordgo.MessageCreate) { func (app *application) sendPepe(s *discordgo.Session, m *discordgo.MessageCreate) {
@ -361,7 +372,7 @@ func (app *application) checkIfAdmin(s *discordgo.Session, m *discordgo.MessageC
return false, nil return false, nil
} }
func (app *application) contextLength(splitCommand []string) (error) { func (app *application) contextLength(splitCommand []string) error {
if !(len(splitCommand) > 2) { if !(len(splitCommand) > 2) {
app.errorLog.Printf("The command's context was not enough.\n") app.errorLog.Printf("The command's context was not enough.\n")
return errors.New("not enough context") return errors.New("not enough context")