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

Commit

Permalink
Merge pull request #16 from takayama-lily/dev
Browse files Browse the repository at this point in the history
-
  • Loading branch information
takayama-lily authored Sep 2, 2020
2 parents b1200de + 809c171 commit 86f9952
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion client.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class AndroidClient extends Client {
this.logger = log4js.getLogger(`[BOT:${uin}]`);
this.logger.level = config.log_level;

this.sub_appid = config.platform === 1 ? 537062845 : 537062409;
this.sub_appid = config.platform === 1 ? 537062845 : (config.platform === 3 ? 537061176 : 537062409);
this.ignore_self = config.ignore_self;
this.kickoff_reconn = config.kickoff;

Expand Down
32 changes: 18 additions & 14 deletions lib/incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function decodePushReqEvent(blob, c) {
/**
* @returns {void}
*/
async function decodeMessageSvcResponse(blob, c) {
function decodeMessageSvcResponse(blob, c) {
const o = pb.decode("GetMessageResponse", blob);
if (o.resule > 0){
c.sync_finished = true;
Expand Down Expand Up @@ -279,19 +279,23 @@ async function decodeMessageSvcResponse(blob, c) {
c.write(outgoing.buildNewFriendRequestPacket(1, c));
continue;
} else if (type === 33) {
const group_id = common.uin2code(user_id);
user_id = toInt(head.authUin);
if (user_id === c.uin)
await c.getGroupList(true);
c.getGroupMemberList(group_id, true);
try {
c.group_list.get(group_id).member_count++;
c.group_list.get(group_id).last_join_time = common.timestamp();
} catch (e) {}
event.emit(c, "notice.group.increase", {
group_id, user_id,
nickname: head.authNick
});
(async()=>{
const group_id = common.uin2code(user_id);
user_id = toInt(head.authUin);
try {
if (user_id === c.uin)
await c.getGroupList(true);
else {
c.group_list.get(group_id).member_count++;
c.group_list.get(group_id).last_join_time = common.timestamp();
}
} catch (e) {}
await c.getGroupMemberList(group_id, true);
event.emit(c, "notice.group.increase", {
group_id, user_id,
nickname: head.authNick
});
})();
continue;
}
let sub_type, message_id, font, sender = {user_id};
Expand Down
9 changes: 5 additions & 4 deletions lib/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async function downloadImage(url, cb) {

/**
* @param {Boolean} is_group
* @returns {Boolean} success?
* @returns {Boolean|Promise} success?
*/
async function buildImageMessage(chain, cq, is_group) {
let {file, url, cache} = cq;
Expand Down Expand Up @@ -332,7 +332,7 @@ async function buildMessageFromString(chain, message, escape = false, is_group =
break;
case "image":
const task = await buildImageMessage(chain, cq, is_group);
if (task)
if (task !== false)
++img_cnt;
if (task instanceof Promise)
tasks.push(task);
Expand Down Expand Up @@ -379,11 +379,12 @@ async function buildMessage(message, escape, is_group) {
++face_cnt;
break;
case "image":
const task = await buildImageMessage(chain, v.data, is_group)
if (task)
const task = await buildImageMessage(chain, v.data, is_group);
if (task !== false)
++img_cnt;
if (task instanceof Promise)
tasks.push(task);
break;
default:
break;
}
Expand Down
6 changes: 6 additions & 0 deletions lib/outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,12 @@ async function toLongMessageElems(uin, elems, c) {
msgId: 1,
},
msgType: 82,
// groupInfo: {
// groupCode: common.uin2code(uin),
// groupRank: 2,
// groupName: Buffer.from("abc"),
// groupCard: c.nickname,
// },
},
body: {
richText: {elems},
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oicq",
"version": "1.0.6",
"version": "1.0.11",
"description": "QQ protocol!",
"main": "client.js",
"scripts": {
Expand Down

0 comments on commit 86f9952

Please sign in to comment.