diff --git a/discord/discord.go b/discord/discord.go index 1c17b03..cebc139 100644 --- a/discord/discord.go +++ b/discord/discord.go @@ -1,8 +1,6 @@ package main import ( - "strings" - "github.com/bwmarrin/discordgo" ) @@ -18,12 +16,12 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message return } */ - app.limiter.LogInteraction(m.Author.ID, "messagecreate") + //app.limiter.LogInteraction(m.Author.ID, "messagecreate") /* Check if the user is even allowed by the rate limiter */ - err := app.limiter.CheckAllowed(m.Author.ID) + /* err := app.limiter.CheckAllowed(m.Author.ID) if err != nil { - /* normally don't send, but now do for debug purposes. This is the admin bot channel */ + /* normally don't send, but now do for debug purposes. This is the admin bot channel * //app.unknownError(err, s, true, "815952128106430514") app.infoLog.Printf("Rate limit exceeded by used %s", m.Author.Username) channel, err := s.UserChannelCreate(m.Author.ID) @@ -33,24 +31,24 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message } s.ChannelMessageSend(channel.ID, "You exceeded the rate limit for the server, please stop spamming") return - } + } */ /* Checking if the message starts with the trigger specified in application struct if it does then we start the switch statement to trigger the appropriate function if it does not then we check if it contains a triggerword from the database */ - if strings.HasPrefix(m.Content, app.trigger) { + /* if strings.HasPrefix(m.Content, app.trigger) { splitCommand := strings.Split(strings.TrimSpace(m.Content), " ") - /* If the whole message on it's own is just "!pepe" aka the triggerword, then send a pepe and stop */ + /* If the whole message on it's own is just "!pepe" aka the triggerword, then send a pepe and stop * if strings.TrimSpace(m.Content) == app.trigger { app.sendPepe(s, m) return } /* This switches on the first word in the message - it could be anything starting with !pepe */ + it could be anything starting with !pepe * if len(splitCommand) > 1 { switch splitCommand[1] { - /* --- Funny commands --- */ + /* --- Funny commands --- * case "cringe": app.sendCringe(s, m) case "gif": @@ -61,12 +59,12 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message app.sendWednesday(s, m) case "github", "source": app.sendGithub(s, m) - /* --- Bot commands for words --- */ + /* --- Bot commands for words --- * case "spam": app.sendManyPepes(s, m, splitCommand) case "stop": app.stopRequest(s, m) - /* --- Bot commands, but only admins --- */ + /* --- Bot commands, but only admins --- * case "addword": app.addWord(s, m, splitCommand) case "removeword": @@ -79,8 +77,8 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message } } else { - /* If the trigger wasn't the prefix of the message, we need to check all the words for a trigger */ + /* If the trigger wasn't the prefix of the message, we need to check all the words for a trigger app.findTrigger(s, m) - } + } */ } diff --git a/discord/handlers.go b/discord/handlers.go index dcd1578..bde38c5 100644 --- a/discord/handlers.go +++ b/discord/handlers.go @@ -5,7 +5,3 @@ import "github.com/bwmarrin/discordgo" func newCringe(s *discordgo.Session, m *discordgo.MessageCreate) { s.ChannelMessageSend(m.ChannelID, "this is a test message right from the new command system!") } - -func newSendPepe(s *discordgo.Session, m *discordgo.MessageCreate) { - s.ChannelMessageSend(m.ChannelID, "cmd not yet working, but this needed to be registered otherwise the code would break") -} diff --git a/discord/main.go b/discord/main.go index 42b977d..8083710 100644 --- a/discord/main.go +++ b/discord/main.go @@ -63,7 +63,7 @@ func main() { } mux := NewCommandMux() - mux.prefix = "!newpepe" + mux.prefix = "!pepe" app := &application{ infoLog: infoLog, @@ -80,7 +80,21 @@ func main() { app.errorLog.Fatal(err) } - mux.HandleFunc("newcringe", newCringe) + mux.HandleFunc("cringe", app.sendCringe) + mux.HandleFunc("gif", app.sendNigelGif) + mux.HandleFunc("tuesday", app.sendTuesday) + mux.HandleFunc("wednesday", app.sendWednesday) + mux.HandleFunc("github", app.sendGithub) + mux.HandleFunc("source", app.sendGithub) + /* The admin commands are left out for now. + They have specialised functions and don't work yet. + Their code is left unworking and nonfunctional to be fixed + sometime in the future... sometime + + Another thing left out is the bad words feature. + It goes underused and has had it's joke. + + Oh and no one must be sad to see the death of the spam command...*/ mux.HandleFunc(mux.prefix, app.sendPepe) /* token, err := app.readAuthToken()