mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-09 03:20:11 +08:00
Merge remote-tracking branch 'origin'
This commit is contained in:
commit
7efcdf5a5b
@ -2,6 +2,14 @@
|
||||
|
||||
开发版本. 频繁更新, 不保证高稳定性
|
||||
|
||||
## `0.15.1` Unreleased
|
||||
|
||||
### mirai-core
|
||||
- 统一异常处理: 所有群成员相关操作无权限时均抛出异常而不返回 `false`.
|
||||
|
||||
### mirai-core-qqandroid
|
||||
- 初始化未完成时缓存接收的所有事件包 (#46)
|
||||
|
||||
## `0.15.0` 2020/2/14
|
||||
|
||||
### mirai-core
|
||||
|
@ -438,14 +438,14 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
|
||||
*/
|
||||
@MessageDsl
|
||||
inline fun <reified M : Message> has(): ListeningFilter =
|
||||
content { message.any { it::class == M::class } }
|
||||
content { message.any { it is M } }
|
||||
|
||||
/**
|
||||
* 如果消息内容包含 [M] 类型的 [Message], 就执行 [onEvent]
|
||||
*/
|
||||
@MessageDsl
|
||||
inline fun <reified M : Message> has(crossinline onEvent: MessageListener<T>): Listener<T> =
|
||||
content({ message.any { it::class == M::class } }, onEvent)
|
||||
content({ message.any { it is M } }, onEvent)
|
||||
|
||||
/**
|
||||
* 如果 [filter] 返回 `true`
|
||||
|
BIN
mirai-japt/.README_images/0ff38fe6.png
Normal file
BIN
mirai-japt/.README_images/0ff38fe6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
mirai-japt/.README_images/4SY8BC@J4ZKQM]7OZ_~BC1I_1.png
Normal file
BIN
mirai-japt/.README_images/4SY8BC@J4ZKQM]7OZ_~BC1I_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
BIN
mirai-japt/.README_images/722W(E$HTTX{D6XFFH]]$43.png
Normal file
BIN
mirai-japt/.README_images/722W(E$HTTX{D6XFFH]]$43.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
BIN
mirai-japt/.README_images/ce3034e3.png
Normal file
BIN
mirai-japt/.README_images/ce3034e3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
@ -3,7 +3,47 @@
|
||||
|
||||
Mirai Java Apt
|
||||
|
||||
提供一些阻塞/异步/RxJava API 来让 Java 调用 Mirai 的挂起函数 API 更容易
|
||||
提供 Utils 类来让 Java 调用 Mirai 的内联方法更容易
|
||||
提供阻塞API 来让 Java 调用 Mirai 的 API 更容易
|
||||
|
||||
该模块暂未完成.
|
||||
## 开始
|
||||
|
||||
```java
|
||||
class Test{
|
||||
public static void main(String[] args){
|
||||
BlockingBot bot = BlockingBot.newInstance(123456, "");
|
||||
|
||||
bot.login();
|
||||
|
||||
bot.getFriendList().forEach(friend -> {
|
||||
System.out.println(friend.getNick());
|
||||
});
|
||||
|
||||
Events.subscribeAlways(GroupMessage.class, (GroupMessage message) -> {
|
||||
final BlockingQQ sender = BlockingContacts.createBlocking(message.getSender());
|
||||
|
||||
sender.sendMessage("Hello");
|
||||
});
|
||||
|
||||
Thread.sleep(999999999);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 便捷开发
|
||||
|
||||
在 IntelliJ IDEA 或 Android Studio 中找到设置 `Editor -> General -> Postfix Completion`, 添加一个设置到 `Java` 分类中:
|
||||

|
||||
Applicable expression types:
|
||||
```
|
||||
net.mamoe.mirai.contact.Contact
|
||||
```
|
||||
转换后表达式:
|
||||
```
|
||||
net.mamoe.mirai.japt.BlockingContacts.createBlocking($EXPR$)
|
||||
```
|
||||
|
||||
效果:
|
||||
|
||||

|
||||
|
||||

|
||||
|
@ -1,8 +1,12 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.jfrog.bintray") version "1.8.4-jetbrains-3" // DO NOT CHANGE THIS VERSION UNLESS YOU WANT TO WASTE YOUR TIME
|
||||
}
|
||||
|
||||
apply(from = rootProject.file("gradle/publish.gradle"))
|
||||
|
||||
val kotlinVersion: String by rootProject.ext
|
||||
val atomicFuVersion: String by rootProject.ext
|
||||
val coroutinesVersion: String by rootProject.ext
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.mamoe.mirai.japt;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import net.mamoe.mirai.contact.MemberPermission;
|
||||
import net.mamoe.mirai.contact.PermissionDeniedException;
|
||||
import net.mamoe.mirai.event.events.MemberCardChangeEvent;
|
||||
@ -40,7 +41,7 @@ public interface BlockingMember extends BlockingQQ {
|
||||
@NotNull
|
||||
default String getGroupCardOrNick() {
|
||||
String nameCard = this.getNameCard();
|
||||
if (!nameCard.isBlank()) {
|
||||
if (!StringsKt.isBlank(nameCard)) {
|
||||
return nameCard;
|
||||
}
|
||||
return this.getNick();
|
||||
|
Loading…
Reference in New Issue
Block a user