mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-07 06:56:58 +08:00
add @SinceMirai("1.2.0") to voice upload api
This commit is contained in:
parent
10a9a035e1
commit
ea8ed17844
@ -453,6 +453,7 @@ internal class GroupImpl(
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("1.2.0")
|
||||
override suspend fun uploadGroupVoice(input: InputStream): Voice {
|
||||
val content = ByteArray(input.available())
|
||||
input.read(content)
|
||||
@ -462,7 +463,7 @@ internal class GroupImpl(
|
||||
val md5 = MiraiPlatformUtils.md5(content)
|
||||
return bot.network.run {
|
||||
val response: PttStore.GroupPttUp.Response.RequireUpload =
|
||||
PttStore.GroupPttUp(bot.client, bot.id, 0L, md5, content.size.toLong()).sendAndExpect()
|
||||
PttStore.GroupPttUp(bot.client, bot.id, id, md5, content.size.toLong()).sendAndExpect()
|
||||
HighwayHelper.uploadPttToServers(
|
||||
bot,
|
||||
response.uploadIpList.zip(response.uploadPortList),
|
||||
|
@ -182,6 +182,7 @@ public abstract class Group : Contact(), CoroutineScope {
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("1.2.0")
|
||||
public abstract suspend fun uploadGroupVoice(input: InputStream): Voice
|
||||
|
||||
|
||||
|
@ -127,6 +127,7 @@ public suspend fun File.uploadAsImage(contact: Contact): Image {
|
||||
*/
|
||||
@Throws(OverFileSizeMaxException::class)
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("1.2.0")
|
||||
public suspend fun InputStream.uploadAsGroupVoice(group: Group): Voice {
|
||||
return group.uploadGroupVoice(this)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user