From eae4934880e70b66978e8f08b14c3331ee4a43a3 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Fri, 4 Oct 2019 08:02:43 -0400 Subject: [PATCH] Deleting messages --- cmdDelete.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cmdDelete.go diff --git a/cmdDelete.go b/cmdDelete.go new file mode 100644 index 0000000..60dd7eb --- /dev/null +++ b/cmdDelete.go @@ -0,0 +1,28 @@ +// +build !rm_basic_commands allcommands deletecmd + +package main + +import ( + "fmt" + "strconv" +) + +func init() { + command := Command{ + Cmd: []string{"delete", "del"}, + Description: "$messageId - Delete a message by $messageId", + Help: "", + Exec: cmdDelete, + } + + RegisterCommand(command) +} +func cmdDelete(cmd []string) { + messageID, _ := strconv.Atoi(cmd[1]) + chat := k.NewChat(channel) + _, err := chat.Delete(messageID) + if err != nil { + printToView("Feed", fmt.Sprintf("There was an error deleting your message.")) + } + +}