From 73d9a0a0567877c49c6c4e61fc75ab703af51937 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Thu, 3 Oct 2019 09:22:49 -0400 Subject: [PATCH] Damnit --- cmdReact.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 cmdReact.go diff --git a/cmdReact.go b/cmdReact.go new file mode 100644 index 0000000..21735a2 --- /dev/null +++ b/cmdReact.go @@ -0,0 +1,38 @@ +// +build !rm_basic_commands allcommands reactcmd + +package main + +import ( + "fmt" +) + +func init() { + command := Command{ + Cmd: []string{"react", "r", "+"}, + Description: "React to a message", + Help: "", + Exec: cmdUploadFile, + } + + RegisterCommand(command) +} + +func cmdReact(cmd []string) { + if len(cmd) == 3 { + reactToMessageId(cmd[1], cmd[2]) + } else if len(cmd == 2) { + reactToMessage(cmd[1]) + } + +} + +func reactToMessage(reaction string) { + chat := k.NewChat(channel) + chat.React(lastMessage.ID, reaction) + +} +func reactToMessageId(messageId string, reaction string) { + chat := k.NewChat(channel) + ID, _ := strconv.Atoi(messageId) + chat.React(ID, reaction) +}