From d9ba107c2da2129f926fe6a66a5b06e7fa013636 Mon Sep 17 00:00:00 2001 From: Rye Date: Sun, 8 Mar 2026 18:07:45 +0100 Subject: [PATCH] added cute events as used in for example fluffychat and commet --- src/app/hooks/useCommands.ts | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/app/hooks/useCommands.ts b/src/app/hooks/useCommands.ts index fb171874..bd1eb715 100644 --- a/src/app/hooks/useCommands.ts +++ b/src/app/hooks/useCommands.ts @@ -34,6 +34,8 @@ import { parsePronounsInput } from '$utils/pronouns'; import { useRoomNavigate } from './useRoomNavigate'; import { enrichWidgetUrl } from './useRoomWidgets'; import { useUserProfile } from './useUserProfile'; +import { escapeHTML } from '$utils/transformation'; +import { use } from 'i18next'; export const SHRUG = '¯\\_(ツ)_/¯'; export const TABLEFLIP = '(╯°□°)╯︵ ┻━┻'; @@ -241,6 +243,9 @@ export enum Command { SetExt = 'setext', DelExt = 'delext', DiscardSession = 'discardsession', + // Cute Events + Hug = 'hug', + Cuddle = 'cuddle', } export type CommandContent = { @@ -1295,6 +1300,41 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => { } }, }, + // Cute Events + [Command.Hug]: { + name: Command.Hug, + description: 'Send a hug to someone. Example: /hug [@user:example.org]', + exe: async (payload) => { + const target = payload.trim(); + await mx.sendMessage(room.roomId, { + msgtype: 'im.fluffychat.cute_event', + 'm.mentions': { + user_ids: target ? [target] : [], + }, + cute_type: 'hug', + body: `🤗`, + format: 'org.matrix.custom.html', + formatted_body: `hugs ${escapeHTML(target) ?? 'you'}`, + } as any); + }, + }, + [Command.Cuddle]: { + name: Command.Cuddle, + description: 'Send a cuddle to someone. Example: /cuddle [@user:example.org]', + exe: async (payload) => { + const target = payload.trim(); + await mx.sendMessage(room.roomId, { + msgtype: 'im.fluffychat.cute_event', + cute_type: 'cuddle', + 'm.mentions': { + user_ids: target ? [target] : [], + }, + body: `😊`, + format: 'org.matrix.custom.html', + formatted_body: `cuddles ${escapeHTML(target) ?? 'you'}`, + } as any); + }, + }, }), [mx, navigateRoom, room, profile.displayName, profile.avatarUrl, developerTools] );