mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 02:04:59 +08:00
Remove improper inline functions
This commit is contained in:
parent
43407aa427
commit
8b421ec45c
@ -10,8 +10,7 @@
|
||||
@file:Suppress(
|
||||
"EXPERIMENTAL_UNSIGNED_LITERALS",
|
||||
"EXPERIMENTAL_API_USAGE",
|
||||
"unused",
|
||||
"DECLARATION_CANT_BE_INLINED", "UNCHECKED_CAST", "NOTHING_TO_INLINE"
|
||||
"unused", "UNCHECKED_CAST", "NOTHING_TO_INLINE"
|
||||
)
|
||||
|
||||
@file:JvmMultifileClass
|
||||
@ -105,29 +104,29 @@ public interface MessageEventExtensions<out TSender : User, out TSubject : Conta
|
||||
* 对于群消息事件, 这个方法将会给群 ([subject]) 发送消息
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public suspend inline fun reply(message: Message): MessageReceipt<TSubject> =
|
||||
public suspend fun reply(message: Message): MessageReceipt<TSubject> =
|
||||
subject.sendMessage(message.asMessageChain()) as MessageReceipt<TSubject>
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun reply(plain: String): MessageReceipt<TSubject> =
|
||||
public suspend fun reply(plain: String): MessageReceipt<TSubject> =
|
||||
subject.sendMessage(plain.toMessage().asMessageChain()) as MessageReceipt<TSubject>
|
||||
|
||||
// endregion
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun ExternalImage.upload(): Image = this.upload(subject)
|
||||
public suspend fun ExternalImage.upload(): Image = this.upload(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun ExternalImage.send(): MessageReceipt<TSubject> = this.sendTo(subject)
|
||||
public suspend fun ExternalImage.send(): MessageReceipt<TSubject> = this.sendTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun Image.send(): MessageReceipt<TSubject> = this.sendTo(subject)
|
||||
public suspend fun Image.send(): MessageReceipt<TSubject> = this.sendTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun Message.send(): MessageReceipt<TSubject> = this.sendTo(subject)
|
||||
public suspend fun Message.send(): MessageReceipt<TSubject> = this.sendTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun String.send(): MessageReceipt<TSubject> = this.toMessage().sendTo(subject)
|
||||
public suspend fun String.send(): MessageReceipt<TSubject> = this.toMessage().sendTo(subject)
|
||||
|
||||
// region 引用回复
|
||||
/**
|
||||
@ -136,18 +135,18 @@ public interface MessageEventExtensions<out TSender : User, out TSubject : Conta
|
||||
* 对于群消息事件, 这个方法将会给群 ([subject]) 发送消息
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public suspend inline fun quoteReply(message: MessageChain): MessageReceipt<TSubject> =
|
||||
public suspend fun quoteReply(message: MessageChain): MessageReceipt<TSubject> =
|
||||
reply(this.message.quote() + message)
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun quoteReply(message: Message): MessageReceipt<TSubject> =
|
||||
public suspend fun quoteReply(message: Message): MessageReceipt<TSubject> =
|
||||
reply(this.message.quote() + message)
|
||||
|
||||
@JvmSynthetic
|
||||
public suspend inline fun quoteReply(plain: String): MessageReceipt<TSubject> = reply(this.message.quote() + plain)
|
||||
public suspend fun quoteReply(plain: String): MessageReceipt<TSubject> = reply(this.message.quote() + plain)
|
||||
|
||||
@JvmSynthetic
|
||||
public inline fun At.isBot(): Boolean = target == bot.id
|
||||
public fun At.isBot(): Boolean = target == bot.id
|
||||
|
||||
|
||||
/**
|
||||
@ -155,7 +154,7 @@ public interface MessageEventExtensions<out TSender : User, out TSubject : Conta
|
||||
* @return "http://gchat.qpic.cn/gchatpic_new/..."
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public suspend inline fun Image.url(): String = this@url.queryUrl()
|
||||
public suspend fun Image.url(): String = this@url.queryUrl()
|
||||
}
|
||||
|
||||
/** 一个消息事件在各平台的相关扩展. 请使用 [MessageEventExtensions] */
|
||||
|
@ -7,7 +7,7 @@
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("unused", "DECLARATION_CANT_BE_INLINED")
|
||||
@file:Suppress("unused")
|
||||
|
||||
package net.mamoe.mirai.message
|
||||
|
||||
@ -35,69 +35,69 @@ internal actual interface MessageEventPlatformExtensions<out TSender : User, out
|
||||
// region 上传图片
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun uploadImage(image: BufferedImage): Image = subject.uploadImage(image)
|
||||
suspend fun uploadImage(image: BufferedImage): Image = subject.uploadImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun uploadImage(image: URL): Image = subject.uploadImage(image)
|
||||
suspend fun uploadImage(image: URL): Image = subject.uploadImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun uploadImage(image: Input): Image = subject.uploadImage(image)
|
||||
suspend fun uploadImage(image: Input): Image = subject.uploadImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun uploadImage(image: InputStream): Image = subject.uploadImage(image)
|
||||
suspend fun uploadImage(image: InputStream): Image = subject.uploadImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun uploadImage(image: File): Image = subject.uploadImage(image)
|
||||
suspend fun uploadImage(image: File): Image = subject.uploadImage(image)
|
||||
// endregion
|
||||
|
||||
// region 发送图片
|
||||
@JvmSynthetic
|
||||
suspend inline fun sendImage(image: BufferedImage): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
suspend fun sendImage(image: BufferedImage): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun sendImage(image: URL): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
suspend fun sendImage(image: URL): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun sendImage(image: Input): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
suspend fun sendImage(image: Input): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun sendImage(image: InputStream): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
suspend fun sendImage(image: InputStream): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun sendImage(image: File): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
suspend fun sendImage(image: File): MessageReceipt<TSubject> = subject.sendImage(image)
|
||||
// endregion
|
||||
|
||||
// region 上传图片 (扩展)
|
||||
@JvmSynthetic
|
||||
suspend inline fun BufferedImage.upload(): Image = upload(subject)
|
||||
suspend fun BufferedImage.upload(): Image = upload(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun URL.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
suspend fun URL.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun Input.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
suspend fun Input.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun InputStream.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
suspend fun InputStream.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun File.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
suspend fun File.uploadAsImage(): Image = uploadAsImage(subject)
|
||||
// endregion 上传图片 (扩展)
|
||||
|
||||
// region 发送图片 (扩展)
|
||||
@JvmSynthetic
|
||||
suspend inline fun BufferedImage.send(): MessageReceipt<TSubject> = sendTo(subject)
|
||||
suspend fun BufferedImage.send(): MessageReceipt<TSubject> = sendTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun URL.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
suspend fun URL.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun Input.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
suspend fun Input.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun InputStream.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
suspend fun InputStream.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun File.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
suspend fun File.sendAsImage(): MessageReceipt<TSubject> = sendAsImageTo(subject)
|
||||
// endregion 发送图片 (扩展)
|
||||
}
|
Loading…
Reference in New Issue
Block a user