about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2020-06-29 00:27:55 -0400
committerBen Morrison <ben@gbmor.dev>2020-06-29 00:29:07 -0400
commitaa2f8f617696eb63324ab9b8e79c9c9e491f2986 (patch)
tree860941d86e5e16033bbad6ff4c3e68df76d217b9
parent18abad8d36daccbe9ceb9ba64cf49fb704df5017 (diff)
downloadgoofbot-aa2f8f617696eb63324ab9b8e79c9c9e491f2986.tar.gz
in-chat error message moved to one const
-rw-r--r--main.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/main.go b/main.go
index 5b0e241..fa07a7e 100644
--- a/main.go
+++ b/main.go
@@ -19,6 +19,9 @@ import (
 // ZW is a zero-width character
 const ZW = string(0x200b)
 
+// Generic in-chat error message
+const errMsg = "I'm broke! Fix me! Check my logs!"
+
 // Conf holds all the config info
 type Conf struct {
 	Owner  string `json:"owner"`
@@ -143,7 +146,7 @@ func main() {
 			err := uptime.Run()
 			if err != nil {
 				log.Printf("!uptime error: %v", err.Error())
-				c.Cmd.Reply(e, "I'm broke! Fix me! Check my logs!")
+				c.Cmd.Reply(e, errMsg)
 				return
 			}
 			c.Cmd.Reply(e, out.String())
@@ -157,7 +160,7 @@ func main() {
 			err := who.Run()
 			if err != nil {
 				log.Printf("!users error: %v", err.Error())
-				c.Cmd.Reply(e, "I'm broke! Fix me! Check my logs!")
+				c.Cmd.Reply(e, errMsg)
 				return
 			}
 
@@ -183,7 +186,7 @@ func main() {
 			userdirs, err := ioutil.ReadDir("/home")
 			if err != nil {
 				log.Printf("!totalusers error: %v", err.Error())
-				c.Cmd.Reply(e, "I'm broke! Fix me! Check my logs!")
+				c.Cmd.Reply(e, errMsg)
 				return
 			}
 
@@ -204,7 +207,7 @@ func main() {
 			err := gotify.Run()
 			if err != nil {
 				log.Printf("!admin error: %v", err.Error())
-				c.Cmd.Reply(e, "I'm broke! Fix me! Check my logs!")
+				c.Cmd.Reply(e, errMsg)
 				return
 			}