Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add ShortVideo message support #2739

Merged
merged 44 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5a949d1
initial support for ShortVideo message
Jul 17, 2023
3c75356
dump api
Jul 17, 2023
4c94b45
[core] upload protocol
Aug 1, 2023
4ee4751
[core] short video upload event
Aug 2, 2023
1e0f190
[core] doc
Aug 2, 2023
85f43a1
[core] protocol
Aug 2, 2023
1a19b23
[core] fix mp4 file check
Aug 2, 2023
53c2946
[core] extract fileName from `OnlineShortVideo` to `ShortVideo`
Aug 2, 2023
f21eb65
[core] ShortVideo.Builder
Aug 2, 2023
a26e1f1
[core] mirai code support for `ShortVideo`
Aug 2, 2023
3629e7f
[core] add doc for OnlineShortVideo and OfflineShortVideo
Aug 2, 2023
3385855
[core] fix text
Aug 2, 2023
c8a6b36
dump api
Aug 2, 2023
c38f5ad
update `Contact.uploadShortVideo`·` doc
Aug 3, 2023
263dd98
[core] remove mirai code support for ShortVideo
Aug 3, 2023
47bfc67
[core] ensure Mirai service is loaded before load other services
Aug 3, 2023
0ae2553
[core] introduce `CombinedExternalResource` to reference multiple ext…
Aug 4, 2023
553243a
[core] move refine context key defined in `OnlineShortVideoMsgInterna…
Aug 4, 2023
6a5b9f3
[core] remove data class
Aug 4, 2023
6fe4b63
[core] broadcast `ShortVideoUploadEvent.Failed` event
Aug 4, 2023
d203935
[core] warn when cannot determine fromId
Aug 4, 2023
2fea0c8
[core] add `contentToString` and `toString` for `OnlineShortVideoMsgI…
Aug 4, 2023
c004f6e
[core] optimize imports
Aug 4, 2023
de059c1
[core] import
Aug 4, 2023
428e2e5
[core] revert
Aug 4, 2023
461f612
[core] doc
Aug 4, 2023
342b459
[core] auto close resource
Aug 4, 2023
b50124f
dump api
Aug 6, 2023
75abe69
keep consistence of param name
Aug 12, 2023
0e35672
update doc
Aug 12, 2023
884bc85
move Builder to OfflineShortVideo
Aug 12, 2023
413e97e
optimize RefineContext
Aug 12, 2023
e6bafd3
RefineContext.merge
Aug 12, 2023
fafb134
dump api
Aug 12, 2023
a560b41
fix test
Aug 12, 2023
76391f3
show more video info
Aug 13, 2023
138a679
optimize constructor and builder of offline short video
Aug 13, 2023
12a40ef
optimize thumbnail
Aug 16, 2023
2f93f36
Merge branch 'dev' into short-video-message
Aug 16, 2023
f3c4222
move thumbnail to main constructor arg
Aug 16, 2023
29e799a
dump api
Aug 16, 2023
858e2fe
avoid null cast exception.
Aug 20, 2023
929f550
combine format transition
Aug 20, 2023
b9efcfe
cleanup
Aug 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions mirai-core-api/compatibility-validation/android/api/android.api
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ public abstract interface class net/mamoe/mirai/contact/Contact : kotlinx/corout
public static fun uploadImage (Lnet/mamoe/mirai/contact/Contact;Lnet/mamoe/mirai/utils/ExternalResource;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun uploadImage (Lnet/mamoe/mirai/utils/ExternalResource;)Lnet/mamoe/mirai/message/data/Image;
public abstract fun uploadImage (Lnet/mamoe/mirai/utils/ExternalResource;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun uploadShortVideo (Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ShortVideo;
public abstract fun uploadShortVideo (Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun uploadShortVideo$default (Lnet/mamoe/mirai/contact/Contact;Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/ShortVideo;
public static synthetic fun uploadShortVideo$default (Lnet/mamoe/mirai/contact/Contact;Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}

public final class net/mamoe/mirai/contact/Contact$Companion {
Expand Down Expand Up @@ -1888,6 +1892,13 @@ public final class net/mamoe/mirai/event/events/BeforeImageUploadEvent : net/mam
public fun toString ()Ljava/lang/String;
}

public final class net/mamoe/mirai/event/events/BeforeShortVideoUploadEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/CancellableEvent, net/mamoe/mirai/event/events/BotActiveEvent, net/mamoe/mirai/event/events/BotEvent, net/mamoe/mirai/internal/event/VerboseEvent {
public fun getBot ()Lnet/mamoe/mirai/Bot;
public final fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public final fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public final fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
}

public abstract interface class net/mamoe/mirai/event/events/BotActiveEvent : net/mamoe/mirai/event/events/BotEvent {
}

Expand Down Expand Up @@ -2948,6 +2959,30 @@ public final class net/mamoe/mirai/event/events/OtherClientOnlineEvent : net/mam
public fun toString ()Ljava/lang/String;
}

public abstract class net/mamoe/mirai/event/events/ShortVideoUploadEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/events/BotActiveEvent, net/mamoe/mirai/event/events/BotEvent, net/mamoe/mirai/internal/event/VerboseEvent {
public fun getBot ()Lnet/mamoe/mirai/Bot;
public abstract fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public abstract fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public abstract fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
}

public final class net/mamoe/mirai/event/events/ShortVideoUploadEvent$Failed : net/mamoe/mirai/event/events/ShortVideoUploadEvent {
public final fun getErrno ()I
public final fun getMessage ()Ljava/lang/String;
public fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public fun toString ()Ljava/lang/String;
}

public final class net/mamoe/mirai/event/events/ShortVideoUploadEvent$Succeed : net/mamoe/mirai/event/events/ShortVideoUploadEvent {
public fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public final fun getVideo ()Lnet/mamoe/mirai/message/data/ShortVideo;
public fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public fun toString ()Ljava/lang/String;
}

public final class net/mamoe/mirai/event/events/SignEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/events/BotEvent, net/mamoe/mirai/internal/network/Packet {
public fun getBot ()Lnet/mamoe/mirai/Bot;
public final fun getRank ()Ljava/lang/Integer;
Expand Down Expand Up @@ -4830,6 +4865,39 @@ public abstract class net/mamoe/mirai/message/data/OfflineMessageSource : net/ma
public final class net/mamoe/mirai/message/data/OfflineMessageSource$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public abstract interface class net/mamoe/mirai/message/data/OfflineShortVideo : net/mamoe/mirai/message/data/ShortVideo {
public static final field Key Lnet/mamoe/mirai/message/data/OfflineShortVideo$Key;
public static final field SERIAL_NAME Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/OfflineShortVideo$Builder {
public static final field Companion Lnet/mamoe/mirai/message/data/OfflineShortVideo$Builder$Companion;
public final fun build ()Lnet/mamoe/mirai/message/data/OfflineShortVideo;
public final fun getFileFormat ()Ljava/lang/String;
public final fun getFileMd5 ()[B
public final fun getFileName ()Ljava/lang/String;
public final fun getFileSize ()J
public final fun getThumbnailMd5 ()[B
public final fun getThumbnailSize ()J
public final fun getVideoId ()Ljava/lang/String;
public static final fun newBuilder (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ)Lnet/mamoe/mirai/message/data/OfflineShortVideo$Builder;
public final fun setFileFormat (Ljava/lang/String;)V
public final fun setFileMd5 ([B)V
public final fun setFileName (Ljava/lang/String;)V
public final fun setFileSize (J)V
public final fun setThumbnailMd5 ([B)V
public final fun setThumbnailSize (J)V
public final fun setVideoId (Ljava/lang/String;)V
}

public final class net/mamoe/mirai/message/data/OfflineShortVideo$Builder$Companion {
public final fun newBuilder (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ)Lnet/mamoe/mirai/message/data/OfflineShortVideo$Builder;
}

public final class net/mamoe/mirai/message/data/OfflineShortVideo$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
public static final field SERIAL_NAME Ljava/lang/String;
}

public abstract interface class net/mamoe/mirai/message/data/OnlineAudio : net/mamoe/mirai/message/data/Audio {
public static final field Key Lnet/mamoe/mirai/message/data/OnlineAudio$Key;
public static final field SERIAL_NAME Ljava/lang/String;
Expand Down Expand Up @@ -4978,6 +5046,16 @@ public abstract class net/mamoe/mirai/message/data/OnlineMessageSource$Outgoing$
public final class net/mamoe/mirai/message/data/OnlineMessageSource$Outgoing$ToTemp$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public abstract interface class net/mamoe/mirai/message/data/OnlineShortVideo : net/mamoe/mirai/message/data/ShortVideo {
public static final field Key Lnet/mamoe/mirai/message/data/OnlineShortVideo$Key;
public static final field SERIAL_NAME Ljava/lang/String;
public abstract fun getUrlForDownload ()Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/OnlineShortVideo$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
public static final field SERIAL_NAME Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/OrNullDelegate {
public static final synthetic fun box-impl (Ljava/lang/Object;)Lnet/mamoe/mirai/message/data/OrNullDelegate;
public static fun constructor-impl (Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -5223,6 +5301,24 @@ public abstract interface class net/mamoe/mirai/message/data/ServiceMessage : ne
public final class net/mamoe/mirai/message/data/ServiceMessage$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public abstract interface class net/mamoe/mirai/message/data/ShortVideo : net/mamoe/mirai/message/data/ConstrainSingle, net/mamoe/mirai/message/data/MessageContent {
public static final field Key Lnet/mamoe/mirai/message/data/ShortVideo$Key;
public abstract fun getFileFormat ()Ljava/lang/String;
public abstract fun getFileMd5 ()[B
public abstract fun getFileSize ()J
public abstract fun getFilename ()Ljava/lang/String;
public fun getKey ()Lnet/mamoe/mirai/message/data/MessageKey;
public abstract fun getVideoId ()Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/ShortVideo$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public final class net/mamoe/mirai/message/data/ShortVideoKt {
public static final synthetic fun OfflineShortVideo (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ[BJ)Lnet/mamoe/mirai/message/data/OfflineShortVideo;
public static synthetic fun OfflineShortVideo$default (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ[BJILjava/lang/Object;)Lnet/mamoe/mirai/message/data/OfflineShortVideo;
}

public final class net/mamoe/mirai/message/data/ShowImageFlag : net/mamoe/mirai/message/data/AbstractMessageKey, net/mamoe/mirai/message/data/ConstrainSingle, net/mamoe/mirai/message/data/MessageMetadata {
public static final field INSTANCE Lnet/mamoe/mirai/message/data/ShowImageFlag;
public static final field SERIAL_NAME Ljava/lang/String;
Expand Down
96 changes: 96 additions & 0 deletions mirai-core-api/compatibility-validation/jvm/api/jvm.api
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ public abstract interface class net/mamoe/mirai/contact/Contact : kotlinx/corout
public static fun uploadImage (Lnet/mamoe/mirai/contact/Contact;Lnet/mamoe/mirai/utils/ExternalResource;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun uploadImage (Lnet/mamoe/mirai/utils/ExternalResource;)Lnet/mamoe/mirai/message/data/Image;
public abstract fun uploadImage (Lnet/mamoe/mirai/utils/ExternalResource;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun uploadShortVideo (Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ShortVideo;
public abstract fun uploadShortVideo (Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun uploadShortVideo$default (Lnet/mamoe/mirai/contact/Contact;Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/ShortVideo;
public static synthetic fun uploadShortVideo$default (Lnet/mamoe/mirai/contact/Contact;Lnet/mamoe/mirai/utils/ExternalResource;Lnet/mamoe/mirai/utils/ExternalResource;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}

public final class net/mamoe/mirai/contact/Contact$Companion {
Expand Down Expand Up @@ -1888,6 +1892,13 @@ public final class net/mamoe/mirai/event/events/BeforeImageUploadEvent : net/mam
public fun toString ()Ljava/lang/String;
}

public final class net/mamoe/mirai/event/events/BeforeShortVideoUploadEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/CancellableEvent, net/mamoe/mirai/event/events/BotActiveEvent, net/mamoe/mirai/event/events/BotEvent, net/mamoe/mirai/internal/event/VerboseEvent {
public fun getBot ()Lnet/mamoe/mirai/Bot;
public final fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public final fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public final fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
}

public abstract interface class net/mamoe/mirai/event/events/BotActiveEvent : net/mamoe/mirai/event/events/BotEvent {
}

Expand Down Expand Up @@ -2948,6 +2959,30 @@ public final class net/mamoe/mirai/event/events/OtherClientOnlineEvent : net/mam
public fun toString ()Ljava/lang/String;
}

public abstract class net/mamoe/mirai/event/events/ShortVideoUploadEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/events/BotActiveEvent, net/mamoe/mirai/event/events/BotEvent, net/mamoe/mirai/internal/event/VerboseEvent {
public fun getBot ()Lnet/mamoe/mirai/Bot;
public abstract fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public abstract fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public abstract fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
}

public final class net/mamoe/mirai/event/events/ShortVideoUploadEvent$Failed : net/mamoe/mirai/event/events/ShortVideoUploadEvent {
public final fun getErrno ()I
public final fun getMessage ()Ljava/lang/String;
public fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public fun toString ()Ljava/lang/String;
}

public final class net/mamoe/mirai/event/events/ShortVideoUploadEvent$Succeed : net/mamoe/mirai/event/events/ShortVideoUploadEvent {
public fun getTarget ()Lnet/mamoe/mirai/contact/Contact;
public fun getThumbnailSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public final fun getVideo ()Lnet/mamoe/mirai/message/data/ShortVideo;
public fun getVideoSource ()Lnet/mamoe/mirai/utils/ExternalResource;
public fun toString ()Ljava/lang/String;
}

public final class net/mamoe/mirai/event/events/SignEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/events/BotEvent, net/mamoe/mirai/internal/network/Packet {
public fun getBot ()Lnet/mamoe/mirai/Bot;
public final fun getRank ()Ljava/lang/Integer;
Expand Down Expand Up @@ -4830,6 +4865,39 @@ public abstract class net/mamoe/mirai/message/data/OfflineMessageSource : net/ma
public final class net/mamoe/mirai/message/data/OfflineMessageSource$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public abstract interface class net/mamoe/mirai/message/data/OfflineShortVideo : net/mamoe/mirai/message/data/ShortVideo {
public static final field Key Lnet/mamoe/mirai/message/data/OfflineShortVideo$Key;
public static final field SERIAL_NAME Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/OfflineShortVideo$Builder {
public static final field Companion Lnet/mamoe/mirai/message/data/OfflineShortVideo$Builder$Companion;
public final fun build ()Lnet/mamoe/mirai/message/data/OfflineShortVideo;
public final fun getFileFormat ()Ljava/lang/String;
public final fun getFileMd5 ()[B
public final fun getFileName ()Ljava/lang/String;
public final fun getFileSize ()J
public final fun getThumbnailMd5 ()[B
public final fun getThumbnailSize ()J
public final fun getVideoId ()Ljava/lang/String;
public static final fun newBuilder (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ)Lnet/mamoe/mirai/message/data/OfflineShortVideo$Builder;
public final fun setFileFormat (Ljava/lang/String;)V
public final fun setFileMd5 ([B)V
public final fun setFileName (Ljava/lang/String;)V
public final fun setFileSize (J)V
public final fun setThumbnailMd5 ([B)V
public final fun setThumbnailSize (J)V
public final fun setVideoId (Ljava/lang/String;)V
}

public final class net/mamoe/mirai/message/data/OfflineShortVideo$Builder$Companion {
public final fun newBuilder (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ)Lnet/mamoe/mirai/message/data/OfflineShortVideo$Builder;
}

public final class net/mamoe/mirai/message/data/OfflineShortVideo$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
public static final field SERIAL_NAME Ljava/lang/String;
}

public abstract interface class net/mamoe/mirai/message/data/OnlineAudio : net/mamoe/mirai/message/data/Audio {
public static final field Key Lnet/mamoe/mirai/message/data/OnlineAudio$Key;
public static final field SERIAL_NAME Ljava/lang/String;
Expand Down Expand Up @@ -4978,6 +5046,16 @@ public abstract class net/mamoe/mirai/message/data/OnlineMessageSource$Outgoing$
public final class net/mamoe/mirai/message/data/OnlineMessageSource$Outgoing$ToTemp$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public abstract interface class net/mamoe/mirai/message/data/OnlineShortVideo : net/mamoe/mirai/message/data/ShortVideo {
public static final field Key Lnet/mamoe/mirai/message/data/OnlineShortVideo$Key;
public static final field SERIAL_NAME Ljava/lang/String;
public abstract fun getUrlForDownload ()Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/OnlineShortVideo$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
public static final field SERIAL_NAME Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/OrNullDelegate {
public static final synthetic fun box-impl (Ljava/lang/Object;)Lnet/mamoe/mirai/message/data/OrNullDelegate;
public static fun constructor-impl (Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -5223,6 +5301,24 @@ public abstract interface class net/mamoe/mirai/message/data/ServiceMessage : ne
public final class net/mamoe/mirai/message/data/ServiceMessage$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public abstract interface class net/mamoe/mirai/message/data/ShortVideo : net/mamoe/mirai/message/data/ConstrainSingle, net/mamoe/mirai/message/data/MessageContent {
public static final field Key Lnet/mamoe/mirai/message/data/ShortVideo$Key;
public abstract fun getFileFormat ()Ljava/lang/String;
public abstract fun getFileMd5 ()[B
public abstract fun getFileSize ()J
public abstract fun getFilename ()Ljava/lang/String;
public fun getKey ()Lnet/mamoe/mirai/message/data/MessageKey;
public abstract fun getVideoId ()Ljava/lang/String;
}

public final class net/mamoe/mirai/message/data/ShortVideo$Key : net/mamoe/mirai/message/data/AbstractPolymorphicMessageKey {
}

public final class net/mamoe/mirai/message/data/ShortVideoKt {
public static final synthetic fun OfflineShortVideo (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ[BJ)Lnet/mamoe/mirai/message/data/OfflineShortVideo;
public static synthetic fun OfflineShortVideo$default (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ[BJILjava/lang/Object;)Lnet/mamoe/mirai/message/data/OfflineShortVideo;
}

public final class net/mamoe/mirai/message/data/ShowImageFlag : net/mamoe/mirai/message/data/AbstractMessageKey, net/mamoe/mirai/message/data/ConstrainSingle, net/mamoe/mirai/message/data/MessageMetadata {
public static final field INSTANCE Lnet/mamoe/mirai/message/data/ShowImageFlag;
public static final field SERIAL_NAME Ljava/lang/String;
Expand Down
22 changes: 20 additions & 2 deletions mirai-core-api/src/commonMain/kotlin/contact/Contact.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public interface Contact : ContactOrBot, CoroutineScope {
/**
* 上传一个 [资源][ExternalResource] 作为图片以备发送.
*
* **无论上传是否成功都不会关闭 [resource]. 需要调用方手动关闭资源**
*
* 也可以使用其他扩展: [ExternalResource.uploadAsImage] 使用 [File], [InputStream] 等上传.
*
* @see Image 查看有关图片的更多信息, 如上传图片
Expand All @@ -88,6 +86,26 @@ public interface Contact : ContactOrBot, CoroutineScope {
*/
public suspend fun uploadImage(resource: ExternalResource): Image

/**
* 上传 [资源][ExternalResource] 作为短视频发送.
* 同时需要上传缩略图作为视频消息显示的封面.
*
* @see ShortVideo 查看有关短视频的更多信息
*
* @see BeforeShortVideoUploadEvent 短视频发送前事件,可通过中断来拦截视频上传.
* @see ShortVideoUploadEvent 短视频上传完成事件,不可拦截.
*
* @param thumbnail 短视频封面图,为图片资源.
* @param video 视频资源,目前仅支持上传 mp4 格式的视频.
* @param fileName 文件名,若为 `null` 则根据 [video] 自动生成.
*/
public suspend fun uploadShortVideo(
thumbnail: ExternalResource,
video: ExternalResource,
fileName: String? = null
StageGuard marked this conversation as resolved.
Show resolved Hide resolved
): ShortVideo

@JvmBlockingBridge
public companion object {
/**
* 读取 [InputStream] 到临时文件并将其作为图片发送到指定联系人
Expand Down
Loading
Loading