From 575a07dd0105a65b485fa46730ade3763b103368 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Wed, 5 May 2021 22:47:47 -0400 Subject: [PATCH] Added help for commands --- commands.go | 7 +++++++ config.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 3e6c605..3a813d1 100644 --- a/commands.go +++ b/commands.go @@ -13,6 +13,7 @@ import ( func setupCommands() { reboot := Command{ Name: "Reboot", + Help: "Reboot me, requires token from logs.", Keywords: []string{"reboot", "re", "restart"}, Exec: Reboot, } @@ -20,6 +21,7 @@ func setupCommands() { bumpset := Command{ Name: "BumpSet", + Help: "Set the bump timer (requires time in minutes until next bump).", Keywords: []string{"bs", "bumpset", "bumps"}, Exec: BumpSet, } @@ -27,6 +29,7 @@ func setupCommands() { retrieveVerification := Command{ Name: "Retrieve Verification", + Help: "Retrieve verification either by discord ID or by nickname", Keywords: []string{"veri", "verification", "retrieve"}, Exec: RetrieveVerification, } @@ -90,6 +93,7 @@ func RetrieveVerification(b BotCommand) bool { user, err := s.GuildMember(config.GuildID, discordId) if err != nil { log.LogErrorType(err) + return false } matches, err := filepath.Glob(fmt.Sprintf("./verifications/*%+v*", discordId)) @@ -128,6 +132,7 @@ func Snap(b BotCommand) bool { func Status(b BotCommand) bool { defer log.PanicSafe() status := fmt.Sprintf("Uptime: %+v\n", time.Since(startupTime)) + status += fmt.Sprintf("Last active time: %+v\n", time.Since(lastActiveTime)) status += fmt.Sprintf("Last bump: %+v\n", time.Since(config.BumpTime)) status += fmt.Sprintf("Last bumper: <@%+v>\n", userFromID(config.LastBumper).Username) status += fmt.Sprintf("Bump needed: %+v\n", bump) @@ -158,6 +163,8 @@ func Status(b BotCommand) bool { status += fmt.Sprintf("%+v for another %+v\n", probationUser.Username, time.Until(join.Add(2*time.Hour))) } status += "```" + }else { + status += "There are no users on probation." } b.Session.ChannelMessageSend(config.AdminChannel, status) statistics := "```" diff --git a/config.go b/config.go index ac0e179..b9c5aa7 100644 --- a/config.go +++ b/config.go @@ -82,7 +82,7 @@ func bumpTimer(s *discordgo.Session) { bump = false config.BumpTime = time.Now() time.Sleep(2 * time.Hour) - if time.Since(lastActiveTime) < (5*time.Minute) && lastActiveChan != config.AdminChannel { + if time.Since(lastActiveTime) < (5*time.Minute) { s.ChannelMessageSend(lastActiveChan, "!d bump is ready, please use it. (say \"!d bump\" without the quotes)") } s.ChannelMessageSend(config.AdminChannel, "!d bump is ready.")