Added reload command

This commit is contained in:
DutchEllie 2021-09-23 13:37:51 +02:00
parent 04a5024064
commit 14b8617d81
1 changed files with 29 additions and 4 deletions

View File

@ -1,6 +1,10 @@
package main
import "github.com/bwmarrin/discordgo"
import (
"net/http"
"github.com/bwmarrin/discordgo"
)
func (app *application) addWord(s *discordgo.Session, m *discordgo.MessageCreate, splitCommand []string) {
/* Check if admin */
@ -26,8 +30,6 @@ func (app *application) addWord(s *discordgo.Session, m *discordgo.MessageCreate
return
}
err = app.updateAllBadWords()
if err != nil {
app.unknownError(err, s, true, m.ChannelID)
@ -165,3 +167,26 @@ func (app *application) removeAdmin(s *discordgo.Session, m *discordgo.MessageCr
app.successMessage(s, m)
}
func (app *application) reloadPepeList(s *discordgo.Session, m *discordgo.MessageCreate) {
/* Check if admin */
r, err := app.checkIfAdmin(s, m)
if err != nil {
app.errorLog.Print(err)
return
}
if !r {
return
}
s.ChannelMessageSend(m.ChannelID, "Reloading list of pepes")
url := "http://" + app.pepeServer + "/reload"
_, err = http.Get(url)
if err != nil {
app.errorLog.Print(err)
s.ChannelMessageSend(m.ChannelID, "An error occured!")
return
}
app.successMessage(s, m)
}