diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx
index 5fcfb472..2d7ab40d 100644
--- a/src/app/components/RenderMessageContent.tsx
+++ b/src/app/components/RenderMessageContent.tsx
@@ -33,6 +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';
type RenderMessageContentProps = {
displayName: string;
@@ -348,6 +349,15 @@ function RenderMessageContentInternal({
if (msgType === MsgType.Location) return ;
if (msgType === 'm.bad.encrypted') return ;
+ // cute events
+ if (msgType === 'im.fluffychat.cute_event')
+ return (
+
+ );
return ;
}
diff --git a/src/app/components/message/MCuteEvent.tsx b/src/app/components/message/MCuteEvent.tsx
new file mode 100644
index 00000000..885bba05
--- /dev/null
+++ b/src/app/components/message/MCuteEvent.tsx
@@ -0,0 +1,58 @@
+// rendering for cute events (e.g. hug, cuddle, etc.)
+
+import { MessageTextBody } from './layout';
+
+enum CuteEventType {
+ Hug = 'hug',
+ Cuddle = 'cuddle',
+ Wave = 'wave',
+ Poke = 'poke',
+ // currently unused, but could be added in the future if there's demand for it
+ Kiss = 'kiss',
+}
+
+type MCuteEventProps = {
+ // Content is only used to check if the event is valid, the actual text is generated based on the type and mentioned users
+ content: string | undefined;
+ // The type of cute event (e.g. hug, cuddle, etc.)
+ type: CuteEventType;
+ // The user IDs mentioned in the event (e.g. the target of the hug/cuddle/etc.)
+ mentionedUserIds?: string[];
+};
+
+export function MCuteEvent({ content, type, mentionedUserIds }: MCuteEventProps) {
+ if (!content) return null;
+
+ let cuteText = '';
+ switch (type) {
+ case CuteEventType.Hug:
+ cuteText = `hugs ${mentionedUserIds?.[0] || 'you'}`;
+ break;
+ case CuteEventType.Cuddle:
+ cuteText = `cuddles ${mentionedUserIds?.[0] || 'you'}`;
+ break;
+ case CuteEventType.Kiss:
+ // in here for future expansion
+ // would need some kind of filtering to prevent abuse (e.g. someone sending a kiss event with a random user ID to harass them)
+ // cuteText = `kisses ${mentionedUserIds?.[0] || 'you'}`;
+ cuteText =
+ 'currently disabled kiss event, in light of potential abuse, may be added in the future with proper filtering';
+ break;
+ case CuteEventType.Wave:
+ cuteText = `waves at ${mentionedUserIds?.[0] || 'you'}`;
+ break;
+ case CuteEventType.Poke:
+ cuteText = `pokes ${mentionedUserIds?.[0] || 'you'}`;
+ break;
+ default:
+ cuteText = `sends ${mentionedUserIds?.[0] || 'you'} a cute event`;
+ }
+
+ return (
+
+
+ {cuteText}
+
+
+ );
+}
diff --git a/src/app/hooks/useCommands.ts b/src/app/hooks/useCommands.ts
index c4a30421..f0dc75ca 100644
--- a/src/app/hooks/useCommands.ts
+++ b/src/app/hooks/useCommands.ts
@@ -31,7 +31,6 @@ import { useSetting } from '$state/hooks/settings';
import { settingsAtom } from '$state/settings';
import { createRoomEncryptionState } from '$components/create-room';
import { parsePronounsInput } from '$utils/pronouns';
-import { escapeHTML } from '$utils/transformation';
import { useRoomNavigate } from './useRoomNavigate';
import { enrichWidgetUrl } from './useRoomWidgets';
import { useUserProfile } from './useUserProfile';
@@ -245,6 +244,9 @@ export enum Command {
// Cute Events
Hug = 'hug',
Cuddle = 'cuddle',
+ // our own cute events, not part of FluffyChat or other clients
+ Wave = 'wave',
+ Poke = 'poke',
}
export type CommandContent = {
@@ -1312,8 +1314,6 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
},
cute_type: 'hug',
body: `🤗`,
- format: 'org.matrix.custom.html',
- formatted_body: `hugs ${escapeHTML(target) ?? 'you'}`,
} as any);
},
},
@@ -1329,8 +1329,36 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
user_ids: target ? [target] : [],
},
body: `😊`,
- format: 'org.matrix.custom.html',
- formatted_body: `cuddles ${escapeHTML(target) ?? 'you'}`,
+ } as any);
+ },
+ },
+ [Command.Wave]: {
+ name: Command.Wave,
+ description: 'Send a wave to someone. Example: /wave [@user:example.org]',
+ exe: async (payload) => {
+ const target = payload.trim();
+ await mx.sendMessage(room.roomId, {
+ msgtype: 'im.fluffychat.cute_event',
+ cute_type: 'wave',
+ 'm.mentions': {
+ user_ids: target ? [target] : [],
+ },
+ body: `👋`,
+ } as any);
+ },
+ },
+ [Command.Poke]: {
+ name: Command.Poke,
+ description: 'Send a poke to someone. Example: /poke [@user:example.org]',
+ exe: async (payload) => {
+ const target = payload.trim();
+ await mx.sendMessage(room.roomId, {
+ msgtype: 'im.fluffychat.cute_event',
+ cute_type: 'poke',
+ 'm.mentions': {
+ user_ids: target ? [target] : [],
+ },
+ body: `🫵`,
} as any);
},
},