Skip to content

Commit 352743d

Browse files
authored
Create api.md
1 parent b73981f commit 352743d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/devhelp/api.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## 在此项目中的QQAPI 你可以在项目中快速复用
2+
3+
### QQ环境相关 QQEnvTool
4+
```java
5+
//获取当前登录QQ号
6+
String myUin = QQEnvTool.getCurrentUin();
7+
8+
//获取QQ的指定QRoute实例
9+
Object iTroopMemberListRepoApi = QQEnvTool.getQRouteApi(ClassUtils.findClass("com.tencent.qqnt.troopmemberlist.ITroopMemberListRepoApi"));
10+
11+
//uin转peerUid
12+
QQEnvTool.getUidFromUin(String uin)
13+
//peerUid转uin
14+
QQEnvTool.getUinFromUid(String uid)
15+
```
16+
17+
---
18+
19+
20+
### 获取当前聊天对象 Contact
21+
* 获取好友/群组聊天对象 包含可能是频道的情况
22+
* @param type 联系人类型 2是群聊 1是好友 为4时创建频道聊天对象
23+
* @param uin 正常的QQ号/群号
24+
* @param guildId 频道id
25+
```java
26+
//获取当前聊天对象
27+
Object contact = ContactUtils.getCurrentContact();
28+
29+
//获取好友聊天对象
30+
Object friendContact = ContactUtils.getFriendContact(String uin);
31+
32+
//获取群聊聊天对象
33+
Object groupContact = ContactUtils.getGroupContact(String groupUin);
34+
35+
//使用chatType获取聊天对象
36+
Object targetContact = ContactUtils.getContact(int type, String uin)
37+
38+
//包含频道情况的获取聊天对象
39+
Object targetContact = ContactUtils.getContact(int type, String uin, String guildId)
40+
```
41+
---
42+
43+
### 监听消息View更新
44+
1.调用QQMessageViewListener.addMessageViewUpdateListener(BaseSwitchFunctionHookItem,QQMessageViewListener.OnChatViewUpdateListener) 参数一为当前功能类,参数二为实现的监听器方法
45+
2.实现QQMessageViewListener.OnChatViewUpdateListener接口 完成onViewUpdateAfter重写 参数一为MsgView 参数二懂的都懂
46+
```java
47+
QQMessageViewListener.addMessageViewUpdateListener(this, new QQMessageViewListener.OnChatViewUpdateListener() {
48+
@Override
49+
public void onViewUpdateAfter(@NonNull View msgItemView, @NonNull Object msgRecord) {
50+
51+
}
52+
});
53+
```

0 commit comments

Comments
 (0)