diff --git a/.changeset/add_cute_events.md b/.changeset/add_cute_events.md
index 62c231a5..0700ef8b 100644
--- a/.changeset/add_cute_events.md
+++ b/.changeset/add_cute_events.md
@@ -2,4 +2,4 @@
sable: minor
---
-Add `/hug`, `/cuddle`, `/wave`, and `/poke` slash commands.
+Add `/hug`, `/cuddle`, `/wave`, `/headpat`, and `/poke` slash commands.
diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx
index 4bf72235..3c2ded07 100644
--- a/src/app/components/RenderMessageContent.tsx
+++ b/src/app/components/RenderMessageContent.tsx
@@ -33,7 +33,7 @@ import { ImageViewer } from './image-viewer';
import { PdfViewer } from './Pdf-viewer';
import { TextViewer } from './text-viewer';
import { ClientSideHoverFreeze } from './ClientSideHoverFreeze';
-import { MCuteEvent } from './message/MCuteEvent';
+import { CuteEventType, MCuteEvent } from './message/MCuteEvent';
type RenderMessageContentProps = {
displayName: string;
@@ -358,6 +358,14 @@ function RenderMessageContentInternal({
mentionedUserIds={content?.['m.mentions']?.user_ids}
/>
);
+ if (msgType === 'fyi.cisnt.headpat')
+ return (
+
+ );
return ;
}
diff --git a/src/app/components/message/MCuteEvent.tsx b/src/app/components/message/MCuteEvent.tsx
index 1294a0a5..0cfa8463 100644
--- a/src/app/components/message/MCuteEvent.tsx
+++ b/src/app/components/message/MCuteEvent.tsx
@@ -2,11 +2,12 @@
import { MessageTextBody } from './layout';
-enum CuteEventType {
+export enum CuteEventType {
Hug = 'hug',
Cuddle = 'cuddle',
Wave = 'wave',
Poke = 'poke',
+ Headpat = 'headpat',
// currently unused, but could be added in the future if there's demand for it
Kiss = 'kiss',
}
@@ -44,6 +45,9 @@ export function MCuteEvent({ content, type, mentionedUserIds }: MCuteEventProps)
case CuteEventType.Poke:
cuteText = `pokes ${mentionedUserIds?.[0] || 'you'}`;
break;
+ case CuteEventType.Headpat:
+ cuteText = `gives headpats to ${mentionedUserIds?.[0] || 'you'}`;
+ break;
default:
cuteText = `sends ${mentionedUserIds?.[0] || 'you'} a cute event`;
}
diff --git a/src/app/hooks/useCommands.ts b/src/app/hooks/useCommands.ts
index f0dc75ca..11a7936e 100644
--- a/src/app/hooks/useCommands.ts
+++ b/src/app/hooks/useCommands.ts
@@ -247,6 +247,7 @@ export enum Command {
// our own cute events, not part of FluffyChat or other clients
Wave = 'wave',
Poke = 'poke',
+ Headpat = 'headpat',
}
export type CommandContent = {
@@ -1362,6 +1363,22 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
} as any);
},
},
+ [Command.Headpat]: {
+ name: Command.Headpat,
+ description: 'Send a headpat to someone. Example: /headpat [@user:example.org]',
+ // not really like any of the other cute events, but it was too good not to include
+ // using a custom msgtype to avoid confusion with the other existing cute events
+ exe: async (payload) => {
+ const target = payload.trim();
+ await mx.sendMessage(room.roomId, {
+ msgtype: 'fyi.cisnt.headpat',
+ 'm.mentions': {
+ user_ids: target ? [target] : [],
+ },
+ body: `*pat pat*`,
+ } as any);
+ },
+ },
}),
[mx, navigateRoom, room, profile.displayName, profile.avatarUrl, developerTools]
);