mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Japt: adapt for core update
This commit is contained in:
parent
97da6fce60
commit
354cc2172d
@ -9,6 +9,7 @@ import net.mamoe.mirai.event.events.EventCancelledException;
|
|||||||
import net.mamoe.mirai.event.events.ImageUploadEvent;
|
import net.mamoe.mirai.event.events.ImageUploadEvent;
|
||||||
import net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent;
|
import net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent;
|
||||||
import net.mamoe.mirai.event.events.MessageSendEvent.GroupMessageSendEvent;
|
import net.mamoe.mirai.event.events.MessageSendEvent.GroupMessageSendEvent;
|
||||||
|
import net.mamoe.mirai.message.MessageReceipt;
|
||||||
import net.mamoe.mirai.message.data.Image;
|
import net.mamoe.mirai.message.data.Image;
|
||||||
import net.mamoe.mirai.message.data.Message;
|
import net.mamoe.mirai.message.data.Message;
|
||||||
import net.mamoe.mirai.message.data.MessageChain;
|
import net.mamoe.mirai.message.data.MessageChain;
|
||||||
@ -42,8 +43,7 @@ public interface BlockingContact {
|
|||||||
* @see FriendMessageSendEvent 发送好友信息事件, cancellable
|
* @see FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
* @see GroupMessageSendEvent 发送群消息事件. cancellable
|
* @see GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
*/
|
*/
|
||||||
// kotlin bug
|
MessageReceipt<? extends Contact> sendMessage(@NotNull MessageChain messages) throws EventCancelledException, IllegalStateException;
|
||||||
void sendMessage(@NotNull MessageChain messages) throws EventCancelledException, IllegalStateException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向这个对象发送消息.
|
* 向这个对象发送消息.
|
||||||
@ -53,7 +53,7 @@ public interface BlockingContact {
|
|||||||
* @see FriendMessageSendEvent 发送好友信息事件, cancellable
|
* @see FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
* @see GroupMessageSendEvent 发送群消息事件. cancellable
|
* @see GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
*/
|
*/
|
||||||
void sendMessage(@NotNull String message) throws EventCancelledException, IllegalStateException;
|
MessageReceipt<? extends Contact> sendMessage(@NotNull String message) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向这个对象发送消息.
|
* 向这个对象发送消息.
|
||||||
@ -63,7 +63,7 @@ public interface BlockingContact {
|
|||||||
* @see FriendMessageSendEvent 发送好友信息事件, cancellable
|
* @see FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
* @see GroupMessageSendEvent 发送群消息事件. cancellable
|
* @see GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
*/
|
*/
|
||||||
void sendMessage(@NotNull Message message) throws EventCancelledException, IllegalStateException;
|
MessageReceipt<? extends Contact> sendMessage(@NotNull Message message) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传一个图片以备发送.
|
* 上传一个图片以备发送.
|
||||||
|
@ -3,6 +3,9 @@ package net.mamoe.mirai.japt;
|
|||||||
import net.mamoe.mirai.contact.*;
|
import net.mamoe.mirai.contact.*;
|
||||||
import net.mamoe.mirai.data.MemberInfo;
|
import net.mamoe.mirai.data.MemberInfo;
|
||||||
import net.mamoe.mirai.event.events.*;
|
import net.mamoe.mirai.event.events.*;
|
||||||
|
import net.mamoe.mirai.message.MessageReceipt;
|
||||||
|
import net.mamoe.mirai.message.data.Message;
|
||||||
|
import net.mamoe.mirai.message.data.MessageChain;
|
||||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI;
|
import net.mamoe.mirai.utils.MiraiExperimentalAPI;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -152,6 +155,36 @@ public interface BlockingGroup extends BlockingContact {
|
|||||||
@Nullable
|
@Nullable
|
||||||
BlockingMember getMemberOrNull(long id);
|
BlockingMember getMemberOrNull(long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向这个对象发送消息.
|
||||||
|
*
|
||||||
|
* @throws EventCancelledException 当发送消息事件被取消
|
||||||
|
* @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出
|
||||||
|
* @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
|
* @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
|
*/
|
||||||
|
MessageReceipt<Group> sendMessage(@NotNull MessageChain messages) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向这个对象发送消息.
|
||||||
|
*
|
||||||
|
* @throws EventCancelledException 当发送消息事件被取消
|
||||||
|
* @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出
|
||||||
|
* @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
|
* @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
|
*/
|
||||||
|
MessageReceipt<Group> sendMessage(@NotNull String message) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向这个对象发送消息.
|
||||||
|
*
|
||||||
|
* @throws EventCancelledException 当发送消息事件被取消
|
||||||
|
* @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出
|
||||||
|
* @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
|
* @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
|
*/
|
||||||
|
MessageReceipt<Group> sendMessage(@NotNull Message message) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查此 id 的群成员是否存在
|
* 检查此 id 的群成员是否存在
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
package net.mamoe.mirai.japt;
|
package net.mamoe.mirai.japt;
|
||||||
|
|
||||||
|
import net.mamoe.mirai.contact.QQ;
|
||||||
import net.mamoe.mirai.data.FriendNameRemark;
|
import net.mamoe.mirai.data.FriendNameRemark;
|
||||||
import net.mamoe.mirai.data.PreviousNameList;
|
import net.mamoe.mirai.data.PreviousNameList;
|
||||||
import net.mamoe.mirai.data.Profile;
|
import net.mamoe.mirai.data.Profile;
|
||||||
|
import net.mamoe.mirai.event.events.EventCancelledException;
|
||||||
|
import net.mamoe.mirai.event.events.MessageSendEvent;
|
||||||
|
import net.mamoe.mirai.message.MessageReceipt;
|
||||||
|
import net.mamoe.mirai.message.data.Message;
|
||||||
|
import net.mamoe.mirai.message.data.MessageChain;
|
||||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI;
|
import net.mamoe.mirai.utils.MiraiExperimentalAPI;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -47,4 +53,35 @@ public interface BlockingQQ extends BlockingContact {
|
|||||||
@MiraiExperimentalAPI(message = "还未支持")
|
@MiraiExperimentalAPI(message = "还未支持")
|
||||||
@NotNull
|
@NotNull
|
||||||
FriendNameRemark queryRemark();
|
FriendNameRemark queryRemark();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向这个对象发送消息.
|
||||||
|
*
|
||||||
|
* @throws EventCancelledException 当发送消息事件被取消
|
||||||
|
* @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出
|
||||||
|
* @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
|
* @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
|
*/
|
||||||
|
MessageReceipt<QQ> sendMessage(@NotNull MessageChain messages) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向这个对象发送消息.
|
||||||
|
*
|
||||||
|
* @throws EventCancelledException 当发送消息事件被取消
|
||||||
|
* @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出
|
||||||
|
* @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
|
* @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
|
*/
|
||||||
|
MessageReceipt<QQ> sendMessage(@NotNull String message) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向这个对象发送消息.
|
||||||
|
*
|
||||||
|
* @throws EventCancelledException 当发送消息事件被取消
|
||||||
|
* @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出
|
||||||
|
* @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable
|
||||||
|
* @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable
|
||||||
|
*/
|
||||||
|
MessageReceipt<QQ> sendMessage(@NotNull Message message) throws EventCancelledException, IllegalStateException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import net.mamoe.mirai.japt.BlockingBot
|
|||||||
import net.mamoe.mirai.japt.BlockingGroup
|
import net.mamoe.mirai.japt.BlockingGroup
|
||||||
import net.mamoe.mirai.japt.BlockingMember
|
import net.mamoe.mirai.japt.BlockingMember
|
||||||
import net.mamoe.mirai.japt.BlockingQQ
|
import net.mamoe.mirai.japt.BlockingQQ
|
||||||
|
import net.mamoe.mirai.message.MessageReceipt
|
||||||
import net.mamoe.mirai.message.data.*
|
import net.mamoe.mirai.message.data.*
|
||||||
import net.mamoe.mirai.utils.ExternalImage
|
import net.mamoe.mirai.utils.ExternalImage
|
||||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||||
@ -35,9 +36,9 @@ internal class BlockingQQImpl(private val delegate: QQ) : BlockingQQ {
|
|||||||
override fun getId(): Long = delegate.id
|
override fun getId(): Long = delegate.id
|
||||||
override fun getNick(): String = delegate.nick
|
override fun getNick(): String = delegate.nick
|
||||||
|
|
||||||
override fun sendMessage(messages: MessageChain) = runBlocking { delegate.sendMessage(messages) }
|
override fun sendMessage(messages: MessageChain): MessageReceipt<QQ> = runBlocking { delegate.sendMessage(messages) }
|
||||||
override fun sendMessage(message: String) = runBlocking { delegate.sendMessage(message.toMessage().toChain()) }
|
override fun sendMessage(message: String): MessageReceipt<QQ> = runBlocking { delegate.sendMessage(message.toMessage().toChain()) }
|
||||||
override fun sendMessage(message: Message) = runBlocking { delegate.sendMessage(message.toChain()) }
|
override fun sendMessage(message: Message): MessageReceipt<QQ> = runBlocking { delegate.sendMessage(message.toChain()) }
|
||||||
override fun uploadImage(image: ExternalImage): Image = runBlocking { delegate.uploadImage(image) }
|
override fun uploadImage(image: ExternalImage): Image = runBlocking { delegate.uploadImage(image) }
|
||||||
|
|
||||||
@MiraiExperimentalAPI
|
@MiraiExperimentalAPI
|
||||||
@ -51,9 +52,9 @@ internal class BlockingQQImpl(private val delegate: QQ) : BlockingQQ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class BlockingGroupImpl(private val delegate: Group) : BlockingGroup {
|
internal class BlockingGroupImpl(private val delegate: Group) : BlockingGroup {
|
||||||
override fun sendMessage(messages: MessageChain) = runBlocking { delegate.sendMessage(messages) }
|
override fun sendMessage(messages: MessageChain): MessageReceipt<Group> = runBlocking { delegate.sendMessage(messages) }
|
||||||
override fun sendMessage(message: String) = runBlocking { delegate.sendMessage(message.toMessage().toChain()) }
|
override fun sendMessage(message: String): MessageReceipt<Group> = runBlocking { delegate.sendMessage(message.toMessage().toChain()) }
|
||||||
override fun sendMessage(message: Message) = runBlocking { delegate.sendMessage(message.toChain()) }
|
override fun sendMessage(message: Message): MessageReceipt<Group> = runBlocking { delegate.sendMessage(message.toChain()) }
|
||||||
override fun getOwner(): BlockingMember = delegate.owner.blocking()
|
override fun getOwner(): BlockingMember = delegate.owner.blocking()
|
||||||
@MiraiExperimentalAPI
|
@MiraiExperimentalAPI
|
||||||
override fun newMember(memberInfo: MemberInfo): Member = delegate.Member(memberInfo)
|
override fun newMember(memberInfo: MemberInfo): Member = delegate.Member(memberInfo)
|
||||||
|
Loading…
Reference in New Issue
Block a user