createMessageByBot method
Implementation
@override
Future<void> createMessageByBot(Message msg) async {
if (msg.isEmpty) return;
final target = room(msg.roomId);
final body = msg.lastMessage();
try {
final normalizedMsg = n.normalize(msg.source, n.message);
await messageDelegate.create(msg.roomId, msg.id, normalizedMsg);
await roomDelegate.update(
msg.roomId,
n.normalize(
_roomMessageUpdatePayload(
target,
msg.id,
body,
senderId: msg.senderId,
),
n.room,
),
);
} catch (e, st) {
errorReporter.report(
e,
stackTrace: st,
source: 'MessageMixin.createMessageByBot',
context: {'roomId': msg.roomId, 'msgId': msg.id},
);
}
}