Merge pull request #7231 from pt2121/pt/12-flip-table
Add support for `/tableflip` command (#12)
This commit is contained in:
commit
4d09f0888d
|
@ -0,0 +1 @@
|
|||
Add support for `/tableflip` command
|
|
@ -2220,6 +2220,7 @@
|
|||
|
||||
<string name="command_description_shrug">Prepends ¯\\_(ツ)_/¯ to a plain-text message</string>
|
||||
<string name="command_description_lenny">Prepends ( ͡° ͜ʖ ͡°) to a plain-text message</string>
|
||||
<string name="command_description_table_flip">Prepends (╯°□°)╯︵ ┻━┻ to a plain-text message</string>
|
||||
|
||||
<string name="create_room_encryption_title">"Enable encryption"</string>
|
||||
<string name="create_room_encryption_description">"Once enabled, encryption cannot be disabled."</string>
|
||||
|
|
|
@ -66,7 +66,8 @@ enum class Command(
|
|||
ADD_TO_SPACE("/addToSpace", null, "spaceId", R.string.command_description_add_to_space, true, false),
|
||||
JOIN_SPACE("/joinSpace", null, "spaceId", R.string.command_description_join_space, true, false),
|
||||
LEAVE_ROOM("/leave", null, "<roomId?>", R.string.command_description_leave_room, true, false),
|
||||
UPGRADE_ROOM("/upgraderoom", null, "newVersion", R.string.command_description_upgrade_room, true, false);
|
||||
UPGRADE_ROOM("/upgraderoom", null, "newVersion", R.string.command_description_upgrade_room, true, false),
|
||||
TABLE_FLIP("/tableflip", null, "<message>", R.string.command_description_table_flip, false, true);
|
||||
|
||||
val allAliases = arrayOf(command, *aliases.orEmpty())
|
||||
|
||||
|
|
|
@ -344,6 +344,9 @@ class CommandParser @Inject constructor() {
|
|||
Command.LENNY.matches(slashCommand) -> {
|
||||
ParsedCommand.SendLenny(message)
|
||||
}
|
||||
Command.TABLE_FLIP.matches(slashCommand) -> {
|
||||
ParsedCommand.SendTableFlip(message)
|
||||
}
|
||||
Command.DISCARD_SESSION.matches(slashCommand) -> {
|
||||
if (messageParts.size == 1) {
|
||||
ParsedCommand.DiscardSession
|
||||
|
|
|
@ -63,6 +63,7 @@ sealed interface ParsedCommand {
|
|||
object DevTools : ParsedCommand
|
||||
data class SendSpoiler(val message: String) : ParsedCommand
|
||||
data class SendShrug(val message: CharSequence) : ParsedCommand
|
||||
data class SendTableFlip(val message: CharSequence) : ParsedCommand
|
||||
data class SendLenny(val message: CharSequence) : ParsedCommand
|
||||
object DiscardSession : ParsedCommand
|
||||
data class ShowUser(val userId: String) : ParsedCommand
|
||||
|
|
|
@ -366,6 +366,11 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(MessageComposerViewEvents.SlashCommandResultOk(parsedCommand))
|
||||
popDraft()
|
||||
}
|
||||
is ParsedCommand.SendTableFlip -> {
|
||||
sendPrefixedMessage("(╯°□°)╯︵ ┻━┻", parsedCommand.message, state.rootThreadEventId)
|
||||
_viewEvents.post(MessageComposerViewEvents.SlashCommandResultOk(parsedCommand))
|
||||
popDraft()
|
||||
}
|
||||
is ParsedCommand.SendChatEffect -> {
|
||||
sendChatEffect(parsedCommand)
|
||||
_viewEvents.post(MessageComposerViewEvents.SlashCommandResultOk(parsedCommand))
|
||||
|
|
Loading…
Reference in New Issue