mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 01:21:18 -08:00
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:
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
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user