package main import ( "github.com/bwmarrin/discordgo" "github.com/bwmarrin/disgord/x/mux" "io/ioutil" "net/http" ) //Generate a heckin swear word func getSwear(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) { resp := "" swear, err := http.Get("https://swear.jawa.moe/") if err != nil { resp = "Error fetching swear: " + err.Error() } defer swear.Body.Close() if swear.StatusCode == http.StatusOK { body, err := ioutil.ReadAll(swear.Body) if err != nil { resp = "Error fetching swear: " + err.Error() } resp = string(body) } s.ChannelMessageSend(m.ChannelID, resp) }