Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit f1fabd8

Browse files
committed
Add /spoiler command
As a temporary measure until we have an extensible Markdown parser. Signed-off-by: Robin Townsend <[email protected]>
1 parent cf0f591 commit f1fabd8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/SlashCommands.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ function success(promise?: Promise<any>) {
154154
*/
155155

156156
export const Commands = [
157+
new Command({
158+
command: 'spoiler',
159+
args: '<message>',
160+
description: _td('Sends the given message as a spoiler'),
161+
runFn: function(roomId, message) {
162+
return success(MatrixClientPeg.get().sendHtmlMessage(
163+
roomId, message,
164+
`<span data-mx-spoiler>${message}</span>`,
165+
));
166+
},
167+
category: CommandCategories.messages,
168+
}),
157169
new Command({
158170
command: 'shrug',
159171
args: '<message>',

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@
415415
"Other": "Other",
416416
"Command error": "Command error",
417417
"Usage": "Usage",
418+
"Sends the given message as a spoiler": "Sends the given message as a spoiler",
418419
"Prepends ¯\\_(ツ)_/¯ to a plain-text message": "Prepends ¯\\_(ツ)_/¯ to a plain-text message",
419420
"Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message": "Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message",
420421
"Prepends ┬──┬ ノ( ゜-゜ノ) to a plain-text message": "Prepends ┬──┬ ノ( ゜-゜ノ) to a plain-text message",

0 commit comments

Comments
 (0)