Add a test command for adding mesage reactions.

This commit is contained in:
SeanOMik 2020-06-18 15:32:28 -05:00
parent 7f7717ce63
commit 61cfff995a
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
1 changed files with 8 additions and 3 deletions

View File

@ -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 eventhandler, streams, nimcordutils, discordobject, user, cache, clientobjects
import strutils, channel, options import strutils, channel, options, message, emoji
const const
nimcordMajor = 0 nimcordMajor = 0
@ -154,7 +154,12 @@ registerEventListener(EventType.evtMessageCreate, proc(bEvt: BaseEvent) =
amount = parseIntEasy(event.message.content.substr(20)) amount = parseIntEasy(event.message.content.substr(20))
let messages = channel.getMessages(MessagesGetRequest(limit: some(amount), before: some(event.message.id))) let messages = channel.getMessages(MessagesGetRequest(limit: some(amount), before: some(event.message.id)))
discard channel.bulkDeleteMessages(messages) 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() waitFor bot.startConnection()