async-matrixSourceAsyncMatrixBridgeDiscordDBReaction

class Reaction

Maps a Discord reaction to a Matrix reaction event.

Uniquely identified by (discord_message_id, discord_sender, discord_emoji_name) — one reaction per emoji per user per message.

reaction = Reaction.create( discord_message_id: "msg1", discord_sender: "user1", discord_emoji_name: "\u1f44d", mxid: "$react1", discord_channel_id: "ch1" )

Definitions

def self.by_discord_message(message_id, channel_id, receiver = "")

Find all reactions on a Discord message.

Implementation

def self.by_discord_message(message_id, channel_id, receiver = "")
  where(
    discord_message_id: message_id,
    discord_channel_id: channel_id,
    discord_channel_receiver: receiver
  ).all
end

def self.by_mxid(mxid)

Find a specific reaction by its Matrix event ID.

Implementation

def self.by_mxid(mxid)
  first(mxid: mxid)
end

def self.by_discord_key(message_id:, sender:, emoji_name:)

Find a specific reaction by Discord compound key.

Implementation

def self.by_discord_key(message_id:, sender:, emoji_name:)
  first(
    discord_message_id: message_id,
    discord_sender: sender,
    discord_emoji_name: emoji_name
  )
end