From 0bb86a3b11195de986b805aba02b51ade6364e49 Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 26 Apr 2022 13:05:51 +0100 Subject: [PATCH] Rearrange functions in MessageVisitor to correspond their hierarchy --- .../message/data/visitor/MessageVisitor.kt | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/visitor/MessageVisitor.kt b/mirai-core-api/src/commonMain/kotlin/message/data/visitor/MessageVisitor.kt index 72c666f17..7f6da07a1 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/visitor/MessageVisitor.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/visitor/MessageVisitor.kt @@ -22,19 +22,11 @@ import net.mamoe.mirai.utils.NotStableForInheritance public interface MessageVisitor { public fun visitMessage(message: Message, data: D): R + // region SingleMessage public fun visitSingleMessage(message: SingleMessage, data: D): R - public fun visitMessageChain(messageChain: MessageChain, data: D): R - public fun visitCombinedMessage(message: CombinedMessage, data: D): R + // region MessageContent public fun visitMessageContent(message: MessageContent, data: D): R - public fun visitMessageMetadata(message: MessageMetadata, data: D): R - - public fun visitMessageOrigin(message: MessageOrigin, data: D): R - public fun visitMessageSource(message: MessageSource, data: D): R - public fun visitQuoteReply(message: QuoteReply, data: D): R - public fun visitCustomMessageMetadata(message: CustomMessageMetadata, data: D): R - public fun visitShowImageFlag(message: ShowImageFlag, data: D): R - public fun visitPlainText(message: PlainText, data: D): R public fun visitAt(message: At, data: D): R @@ -43,25 +35,56 @@ public interface MessageVisitor { @Suppress("DEPRECATION_ERROR") public fun visitVoice(message: net.mamoe.mirai.message.data.Voice, data: D): R public fun visitAudio(message: Audio, data: D): R + + // region HummerMessage public fun visitHummerMessage(message: HummerMessage, data: D): R public fun visitFlashImage(message: FlashImage, data: D): R public fun visitPokeMessage(message: PokeMessage, data: D): R public fun visitVipFace(message: VipFace, data: D): R + + // region MarketFace public fun visitMarketFace(message: MarketFace, data: D): R public fun visitDice(message: Dice, data: D): R + + // endregion + // endregion + public fun visitFace(message: Face, data: D): R public fun visitFileMessage(message: FileMessage, data: D): R public fun visitImage(message: Image, data: D): R public fun visitForwardMessage(message: ForwardMessage, data: D): R public fun visitMusicShare(message: MusicShare, data: D): R + // region RichMessage public fun visitRichMessage(message: RichMessage, data: D): R public fun visitServiceMessage(message: ServiceMessage, data: D): R public fun visitSimpleServiceMessage(message: SimpleServiceMessage, data: D): R public fun visitLightApp(message: LightApp, data: D): R public fun visitAbstractServiceMessage(message: AbstractServiceMessage, data: D): R + // endregion + public fun visitUnsupportedMessage(message: UnsupportedMessage, data: D): R + // endregion + + // region MessageMetadata + public fun visitMessageMetadata(message: MessageMetadata, data: D): R + + public fun visitMessageOrigin(message: MessageOrigin, data: D): R + public fun visitMessageSource(message: MessageSource, data: D): R + public fun visitQuoteReply(message: QuoteReply, data: D): R + public fun visitCustomMessageMetadata(message: CustomMessageMetadata, data: D): R + public fun visitShowImageFlag(message: ShowImageFlag, data: D): R + + // endregion + + // endregion + + // region MessageChain + public fun visitMessageChain(messageChain: MessageChain, data: D): R + public fun visitCombinedMessage(message: CombinedMessage, data: D): R + + // endregion } /**