From 61cfff995a676c9e229f75a19df0eaf7669317df Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Thu, 18 Jun 2020 15:32:28 -0500 Subject: [PATCH] Add a test command for adding mesage reactions. --- src/client.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/client.nim b/src/client.nim index f6cc545..8786dff 100644 --- a/src/client.nim +++ b/src/client.nim @@ -1,6 +1,6 @@ -import websocket, asyncnet, asyncdispatch, json, httpClient, eventdispatcher, strformat +import websocket, asyncdispatch, json, httpClient, eventdispatcher, strformat import eventhandler, streams, nimcordutils, discordobject, user, cache, clientobjects -import strutils, channel, options +import strutils, channel, options, message, emoji const nimcordMajor = 0 @@ -154,7 +154,12 @@ registerEventListener(EventType.evtMessageCreate, proc(bEvt: BaseEvent) = amount = parseIntEasy(event.message.content.substr(20)) let messages = channel.getMessages(MessagesGetRequest(limit: some(amount), before: some(event.message.id))) discard channel.bulkDeleteMessages(messages) - + elif (event.message.content.startsWith("?reactToMessage")): + var channel: Channel = event.message.getMessageChannel(event.client.cache) + if (channel != nil): + let emojis = @[newEmoji("⏮️"), newEmoji("⬅️"), newEmoji("⏹️"), newEmoji("➡️"), newEmoji("⏭️")] + for emoji in emojis: + discard event.message.addReaction(emoji) ) waitFor bot.startConnection() \ No newline at end of file