From 156bbf6c7aa6393f3c0e437554791b682b54c27f Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Thu, 10 Oct 2019 07:19:54 -0400 Subject: [PATCH] Add cmdReply --- cmdReply.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cmdReply.go diff --git a/cmdReply.go b/cmdReply.go new file mode 100644 index 0000000..5080ca0 --- /dev/null +++ b/cmdReply.go @@ -0,0 +1,30 @@ +// +ignore +// +build allcommands replycmd + +package main + +import ( + "strconv" + "strings" +) + +func init() { + command := Command{ + Cmd: []string{"reply", "re"}, + Description: "$messageId $response - Reply to a message", + Help: "", + Exec: cmdReply, + } + + RegisterCommand(command) +} + +func cmdReply(cmd []string) { + chat := k.NewChat(channel) + messageId, err := strconv.Atoi(cmd[1]) + _, err = chat.Reply(messageId, strings.Join(cmd[2:], " ")) + if err != nil { + printToView("Feed", "There was an error with your reply.") + } + return +}