mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
use sealed interface
This commit is contained in:
parent
4f1de34d4c
commit
87adaee549
@ -22,51 +22,51 @@ import org.matrix.android.sdk.api.session.identity.ThreePid
|
||||
/**
|
||||
* Represent a parsed command
|
||||
*/
|
||||
sealed class ParsedCommand {
|
||||
sealed interface ParsedCommand {
|
||||
// This is not a Slash command
|
||||
object ErrorNotACommand : ParsedCommand()
|
||||
object ErrorNotACommand : ParsedCommand
|
||||
|
||||
object ErrorEmptySlashCommand : ParsedCommand()
|
||||
object ErrorEmptySlashCommand : ParsedCommand
|
||||
|
||||
// Unknown/Unsupported slash command
|
||||
class ErrorUnknownSlashCommand(val slashCommand: String) : ParsedCommand()
|
||||
class ErrorUnknownSlashCommand(val slashCommand: String) : ParsedCommand
|
||||
|
||||
// A slash command is detected, but there is an error
|
||||
class ErrorSyntax(val command: Command) : ParsedCommand()
|
||||
class ErrorSyntax(val command: Command) : ParsedCommand
|
||||
|
||||
// Valid commands:
|
||||
|
||||
class SendPlainText(val message: CharSequence) : ParsedCommand()
|
||||
class SendEmote(val message: CharSequence) : ParsedCommand()
|
||||
class SendRainbow(val message: CharSequence) : ParsedCommand()
|
||||
class SendRainbowEmote(val message: CharSequence) : ParsedCommand()
|
||||
class BanUser(val userId: String, val reason: String?) : ParsedCommand()
|
||||
class UnbanUser(val userId: String, val reason: String?) : ParsedCommand()
|
||||
class IgnoreUser(val userId: String) : ParsedCommand()
|
||||
class UnignoreUser(val userId: String) : ParsedCommand()
|
||||
class SetUserPowerLevel(val userId: String, val powerLevel: Int?) : ParsedCommand()
|
||||
class ChangeRoomName(val name: String) : ParsedCommand()
|
||||
class Invite(val userId: String, val reason: String?) : ParsedCommand()
|
||||
class Invite3Pid(val threePid: ThreePid) : ParsedCommand()
|
||||
class JoinRoom(val roomAlias: String, val reason: String?) : ParsedCommand()
|
||||
class PartRoom(val roomAlias: String?) : ParsedCommand()
|
||||
class ChangeTopic(val topic: String) : ParsedCommand()
|
||||
class RemoveUser(val userId: String, val reason: String?) : ParsedCommand()
|
||||
class ChangeDisplayName(val displayName: String) : ParsedCommand()
|
||||
class ChangeDisplayNameForRoom(val displayName: String) : ParsedCommand()
|
||||
class ChangeRoomAvatar(val url: String) : ParsedCommand()
|
||||
class ChangeAvatarForRoom(val url: String) : ParsedCommand()
|
||||
class SetMarkdown(val enable: Boolean) : ParsedCommand()
|
||||
object ClearScalarToken : ParsedCommand()
|
||||
class SendSpoiler(val message: String) : ParsedCommand()
|
||||
class SendShrug(val message: CharSequence) : ParsedCommand()
|
||||
class SendLenny(val message: CharSequence) : ParsedCommand()
|
||||
object DiscardSession : ParsedCommand()
|
||||
class ShowUser(val userId: String) : ParsedCommand()
|
||||
class SendChatEffect(val chatEffect: ChatEffect, val message: String) : ParsedCommand()
|
||||
class CreateSpace(val name: String, val invitees: List<String>) : ParsedCommand()
|
||||
class AddToSpace(val spaceId: String) : ParsedCommand()
|
||||
class JoinSpace(val spaceIdOrAlias: String) : ParsedCommand()
|
||||
class LeaveRoom(val roomId: String) : ParsedCommand()
|
||||
class UpgradeRoom(val newVersion: String) : ParsedCommand()
|
||||
class SendPlainText(val message: CharSequence) : ParsedCommand
|
||||
class SendEmote(val message: CharSequence) : ParsedCommand
|
||||
class SendRainbow(val message: CharSequence) : ParsedCommand
|
||||
class SendRainbowEmote(val message: CharSequence) : ParsedCommand
|
||||
class BanUser(val userId: String, val reason: String?) : ParsedCommand
|
||||
class UnbanUser(val userId: String, val reason: String?) : ParsedCommand
|
||||
class IgnoreUser(val userId: String) : ParsedCommand
|
||||
class UnignoreUser(val userId: String) : ParsedCommand
|
||||
class SetUserPowerLevel(val userId: String, val powerLevel: Int?) : ParsedCommand
|
||||
class ChangeRoomName(val name: String) : ParsedCommand
|
||||
class Invite(val userId: String, val reason: String?) : ParsedCommand
|
||||
class Invite3Pid(val threePid: ThreePid) : ParsedCommand
|
||||
class JoinRoom(val roomAlias: String, val reason: String?) : ParsedCommand
|
||||
class PartRoom(val roomAlias: String?) : ParsedCommand
|
||||
class ChangeTopic(val topic: String) : ParsedCommand
|
||||
class RemoveUser(val userId: String, val reason: String?) : ParsedCommand
|
||||
class ChangeDisplayName(val displayName: String) : ParsedCommand
|
||||
class ChangeDisplayNameForRoom(val displayName: String) : ParsedCommand
|
||||
class ChangeRoomAvatar(val url: String) : ParsedCommand
|
||||
class ChangeAvatarForRoom(val url: String) : ParsedCommand
|
||||
class SetMarkdown(val enable: Boolean) : ParsedCommand
|
||||
object ClearScalarToken : ParsedCommand
|
||||
class SendSpoiler(val message: String) : ParsedCommand
|
||||
class SendShrug(val message: CharSequence) : ParsedCommand
|
||||
class SendLenny(val message: CharSequence) : ParsedCommand
|
||||
object DiscardSession : ParsedCommand
|
||||
class ShowUser(val userId: String) : ParsedCommand
|
||||
class SendChatEffect(val chatEffect: ChatEffect, val message: String) : ParsedCommand
|
||||
class CreateSpace(val name: String, val invitees: List<String>) : ParsedCommand
|
||||
class AddToSpace(val spaceId: String) : ParsedCommand
|
||||
class JoinSpace(val spaceIdOrAlias: String) : ParsedCommand
|
||||
class LeaveRoom(val roomId: String) : ParsedCommand
|
||||
class UpgradeRoom(val newVersion: String) : ParsedCommand
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user