getChannelMessage static method

ChannelMessage getChannelMessage(
  1. Event event
)

Implementation

static ChannelMessage getChannelMessage(Event event) {
  try {
    if (event.kind == 42) {
      var content = event.content;
      Thread thread = Nip10.fromTags(event.tags);
      String channelId = thread.root.eventId;
      return ChannelMessage(
          channelId, event.pubkey, content, thread, event.createdAt);
    }
    throw Exception("${event.kind} is not nip28 compatible");
  } catch (e) {
    throw Exception(e.toString());
  }
}