Skip to content

Add and remove reactions to every message on a channel #32

Answered by rigwild
toastyy00 asked this question in Q&A
Discussion options

You must be logged in to vote

Using the code example from the README.
Supports multiple reactions, scans all messages from the last

To add reaction(s), use let reactionFn = api.addReaction
To delete reaction(s), use let reactionFn = api.deleteReaction

Stop with loop = false

{
  id()
  let channelId = cid
  let amount = 99999999
  let delayMs = 500
  let reactions = ['🤔', '🔥']
  let reactionFn = api.addReaction // or api.deleteReaction

  let beforeMessageId = '8999999999999999999' // Leave it like this to react from latest

  let count = 0
  var loop = true
  while (loop) {
    const messages = await api.getMessages(channelId, 100, { before: beforeMessageId })

    // We reached the start of the conversation
    if (m…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rigwild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants