Changed pepe function

This commit is contained in:
DutchEllie 2021-09-08 22:35:03 +02:00
parent d6d8eb01f3
commit cd788bab4a
1 changed files with 61 additions and 50 deletions

View File

@ -3,10 +3,8 @@ package main
import (
"errors"
"fmt"
"io/ioutil"
"math/rand"
"io"
"net/http"
"regexp"
"strconv"
"strings"
"time"
@ -15,7 +13,7 @@ import (
)
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 {
return "", err
}
@ -33,9 +31,22 @@ func (app *application) getPepeLink() (string, error) {
}
randomIndex := rand.Intn(35)
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) {
@ -361,7 +372,7 @@ func (app *application) checkIfAdmin(s *discordgo.Session, m *discordgo.MessageC
return false, nil
}
func (app *application) contextLength(splitCommand []string) (error) {
func (app *application) contextLength(splitCommand []string) error {
if !(len(splitCommand) > 2) {
app.errorLog.Printf("The command's context was not enough.\n")
return errors.New("not enough context")