Files
Sable/src/app/utils/sendFeedbackToUser.ts
T
2026-04-30 00:38:20 -05:00

17 lines
522 B
TypeScript

import type { Room } from '$types/matrix-sdk';
import { DuplicateStrategy, MatrixEvent } from '$types/matrix-sdk';
export function sendFeedback(msg: string, room: Room, userId: string) {
const localNotice = new MatrixEvent({
type: 'm.room.message',
content: { msgtype: 'm.notice', body: msg },
event_id: `~sable-feedback-${Date.now()}`,
room_id: room.roomId,
sender: userId,
});
room.addLiveEvents([localNotice], {
duplicateStrategy: DuplicateStrategy.Ignore,
addToState: false,
});
}