Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
remove ignore_black
Browse files Browse the repository at this point in the history
add seqid block to grpmsg
  • Loading branch information
takayama-lily committed Aug 23, 2021
1 parent 00e3624 commit 29824bd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
12 changes: 3 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export interface ConfBot {
kickoff?: boolean,
/** 群聊是否屏蔽自己的发言,默认true */
ignore_self?: boolean,
/** 群聊是否屏蔽黑名单人员,默认true */
ignore_black?: boolean,
/** 被风控时是否尝试用分片发送,默认true */
resend?: boolean,
/** raw_message里是否不使用CQ码字符串,而是使用简短易读的形式(如:"[图片][表情]"),可以加快解析速度,默认false */
Expand Down Expand Up @@ -473,6 +471,8 @@ export interface GroupMessageEventData extends CommonMessageEventData {
anonymous: Anonymous | null, //匿名消息
sender: MemberBaseInfo,
atme: boolean,
seqid: number,
block: boolean, //是否已屏蔽
}
export interface Anonymous {
id: number,
Expand Down Expand Up @@ -611,12 +611,6 @@ export interface SyncMessageEventData extends Omit<PrivateMessageEventData, "pos
post_type: "sync",
sync_type: "message", //同步其他客户端发送的私聊
}
// export interface SyncRemarkEventData extends CommonEventData {
// post_type: "sync",
// sync_type: "remark", //同步好友备注
// user_id: number,
// remark: string,
// }
export interface SyncStatusEventData extends CommonEventData {
post_type: "sync",
sync_type: "status", //同步在线状态
Expand All @@ -640,7 +634,7 @@ export interface SyncReadedEventData extends CommonEventData {
user_id?: number,
timestamp?: number, //私聊以时间戳分界
group_id?: number,
seqid?: number, //群聊以seqid分界(关于seqid:https://github.com/takayama-lily/oicq/wiki/93.解析消息ID)
seqid?: number, //群聊以seqid分界
}
export interface SyncBlackEventData extends CommonEventData {
post_type: "sync",
Expand Down
1 change: 0 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class Client extends EventEmitter {
kickoff: false,
brief: false,
ignore_self: true,
ignore_black: true,
resend: true,
reconn_interval: 5,
internal_cache_life: 3600,
Expand Down
2 changes: 2 additions & 0 deletions lib/message/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ async function parseGroupMsg(msg, realtime = false) {
message: parser.message,
raw_message: parser.raw_message,
atme: parser.atme,
block: group[2] === 127,
seqid: seq,
font, sender, time
};
}
Expand Down
3 changes: 1 addition & 2 deletions lib/onlinepush.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ async function groupMsgListener(blob, seq) {

//生成消息id
const head = msg[1], content = msg[2], body = msg[3];
if (head[9][2] === 127) return;
const user_id = head[1], time = head[6], seq = head[5];
const group_id = head[9][1], random = body[1][1][3];
const message_id = genGroupMessageId(group_id, user_id, seq, random, time, content[1]);
Expand All @@ -525,8 +526,6 @@ async function groupMsgListener(blob, seq) {
if (data && data.raw_message) {
if (data.user_id === this.uin && this.config.ignore_self)
return;
if (this.config.ignore_black && this.blacklist.has(data.user_id))
return;
data.reply = (message, auto_escape = false) => this.sendGroupMsg(data.group_id, message, auto_escape);
data.message_id = message_id;
const sender = data.sender;
Expand Down
2 changes: 2 additions & 0 deletions lib/ref.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ export interface MsgHead extends Proto {
},
9: {
1: number, //group_id
2: number, //msg_type
4: Proto, //card
8: Proto, //group_name
},
10: number, //appid
11: number, //subid
13: {
1: number, //disscus_id
4: Proto, //card
Expand Down

0 comments on commit 29824bd

Please sign in to comment.