implement Thread.sendTextEvent

This commit is contained in:
OfficialDakari 2025-10-21 19:20:12 +05:00
parent d5a743622f
commit 784d4e4010
1 changed files with 48 additions and 0 deletions

View File

@ -77,4 +77,52 @@ class Thread {
return event;
}
/// When was the last event received.
DateTime get latestEventReceivedTime {
final lastEventTime = lastEvent?.originServerTs;
if (lastEventTime != null) return lastEventTime;
if (room.membership == Membership.invite) return DateTime.now();
return rootEvent.originServerTs;
}
bool get hasNewMessages {
// TODO: Implement this
return false;
}
Future<String?> sendTextEvent(
String message, {
String? txid,
Event? inReplyTo,
String? editEventId,
bool parseMarkdown = true,
bool parseCommands = true,
String msgtype = MessageTypes.Text,
StringBuffer? commandStdout,
bool addMentions = true,
/// Displays an event in the timeline with the transaction ID as the event
/// ID and a status of SENDING, SENT or ERROR until it gets replaced by
/// the sync event. Using this can display a different sort order of events
/// as the sync event does replace but not relocate the pending event.
bool displayPendingEvent = true,
}) {
return room.sendTextEvent(
message,
txid: txid,
inReplyTo: inReplyTo,
editEventId: editEventId,
parseCommands: parseCommands,
parseMarkdown: parseMarkdown,
msgtype: msgtype,
commandStdout: commandStdout,
addMentions: addMentions,
displayPendingEvent: displayPendingEvent,
threadLastEventId: lastEvent?.eventId,
threadRootEventId: rootEvent.eventId,
);
}
}