Skip to content

Commit 00d5553

Browse files
add tableflip and unflip commands (#2075)
1 parent a142630 commit 00d5553

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/app/features/room/RoomInput.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ import {
103103
} from '../../utils/room';
104104
import { sanitizeText } from '../../utils/sanitize';
105105
import { CommandAutocomplete } from './CommandAutocomplete';
106-
import { Command, SHRUG, useCommands } from '../../hooks/useCommands';
106+
import { Command, SHRUG, TABLEFLIP, UNFLIP, useCommands } from '../../hooks/useCommands';
107107
import { mobileOrTablet } from '../../utils/user-agent';
108108
import { useElementSizeObserver } from '../../hooks/useElementSizeObserver';
109109
import { ReplyLayout, ThreadIndicator } from '../../components/message';
@@ -270,6 +270,12 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
270270
} else if (commandName === Command.Shrug) {
271271
plainText = `${SHRUG} ${plainText}`;
272272
customHtml = `${SHRUG} ${customHtml}`;
273+
} else if (commandName === Command.TableFlip) {
274+
plainText = `${TABLEFLIP} ${plainText}`;
275+
customHtml = `${TABLEFLIP} ${customHtml}`;
276+
} else if (commandName === Command.UnFlip) {
277+
plainText = `${UNFLIP} ${plainText}`;
278+
customHtml = `${UNFLIP} ${customHtml}`;
273279
} else if (commandName) {
274280
const commandContent = commands[commandName as Command];
275281
if (commandContent) {

src/app/hooks/useCommands.ts

+14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import * as roomActions from '../../client/action/room';
66
import { useRoomNavigate } from './useRoomNavigate';
77

88
export const SHRUG = '¯\\_(ツ)_/¯';
9+
export const TABLEFLIP = '(╯°□°)╯︵ ┻━┻';
10+
export const UNFLIP = '┬─┬ノ( º_ºノ)';
911

1012
export function parseUsersAndReason(payload: string): {
1113
users: string[];
@@ -48,6 +50,8 @@ export enum Command {
4850
MyRoomAvatar = 'myroomavatar',
4951
ConvertToDm = 'converttodm',
5052
ConvertToRoom = 'converttoroom',
53+
TableFlip = 'tableflip',
54+
UnFlip = 'unflip',
5155
}
5256

5357
export type CommandContent = {
@@ -78,6 +82,16 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
7882
description: 'Send ¯\\_(ツ)_/¯ as message',
7983
exe: async () => undefined,
8084
},
85+
[Command.TableFlip]: {
86+
name: Command.TableFlip,
87+
description: `Send ${TABLEFLIP} as message`,
88+
exe: async () => undefined,
89+
},
90+
[Command.UnFlip]: {
91+
name: Command.UnFlip,
92+
description: `Send ${UNFLIP} as message`,
93+
exe: async () => undefined,
94+
},
8195
[Command.StartDm]: {
8296
name: Command.StartDm,
8397
description: 'Start direct message with user. Example: /startdm userId1',

0 commit comments

Comments
 (0)