Merge pull request #145 from dozro/fix/headpat-message-event-type-fix

change msgtype to m.emote to be more standard compliant
This commit is contained in:
7w1 authored and GitHub committed 2026-03-10 13:33:32 -05:00
commit 103bdb80f5
3 files changed
+18 -2

No files matched your search

@@ -0,0 +1,5 @@
---
sable: patch
---
chang to more standard compliant msgtype `m.emote` for `/headpat` event
@@ -218,6 +218,15 @@ function RenderMessageContentInternal({
}
if (msgType === MsgType.Emote) {
if (content['fyi.cisnt.headpat']) {
return (
<MCuteEvent
content={content}
type={CuteEventType.Headpat}
mentionedUserIds={content?.['m.mentions']?.user_ids}
/>
);
}
return (
<MEmote
displayName={displayName}
@@ -359,6 +368,7 @@ function RenderMessageContentInternal({
mentionedUserIds={content?.['m.mentions']?.user_ids}
/>
);
// as fallback to render older events where msgtype was set instead of m.emote with a custom property
if (msgType === 'fyi.cisnt.headpat')
return (
<MCuteEvent
+3 -2
View File
@@ -1375,11 +1375,12 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
exe: async (payload) => {
const target = payload.trim();
await mx.sendMessage(room.roomId, {
msgtype: 'fyi.cisnt.headpat',
msgtype: 'm.emote',
'm.mentions': {
user_ids: target ? [target] : [],
},
body: `*pat pat*`,
body: `pats ${target || 'you'}`,
'fyi.cisnt.headpat': true,
} as any);
},
},