|
@@ -134,15 +134,17 @@ class default_1 {
|
|
groupString = `${groupItem.groupName}(${groupId})`;
|
|
groupString = `${groupItem.groupName}(${groupId})`;
|
|
return test;
|
|
return test;
|
|
})) {
|
|
})) {
|
|
- session.bot.handleFriendRequest(session.messageId, true);
|
|
|
|
- return logger.info(`accepted friend request from ${userString} (from group ${groupString})`);
|
|
|
|
|
|
+ return session.bot.handleFriendRequest(session.messageId, true)
|
|
|
|
+ .then(() => { logger.info(`accepted friend request from ${userString} (from group ${groupString})`); })
|
|
|
|
+ .catch(error => { logger.error(`error accepting friend request from ${userString}, error: ${error}`); });
|
|
}
|
|
}
|
|
utils_1.chainPromises(groupList.map(groupItem => (done) => Promise.resolve(done ||
|
|
utils_1.chainPromises(groupList.map(groupItem => (done) => Promise.resolve(done ||
|
|
this.bot.getGroupMember(groupItem.groupId, session.userId).then(() => {
|
|
this.bot.getGroupMember(groupItem.groupId, session.userId).then(() => {
|
|
groupString = `${groupItem.groupName}(${groupItem.groupId})`;
|
|
groupString = `${groupItem.groupName}(${groupItem.groupId})`;
|
|
- session.bot.handleFriendRequest(session.messageId, true);
|
|
|
|
- logger.info(`accepted friend request from ${userString} (found in group ${groupString})`);
|
|
|
|
- return true;
|
|
|
|
|
|
+ return session.bot.handleFriendRequest(session.messageId, true)
|
|
|
|
+ .then(() => { logger.info(`accepted friend request from ${userString} (found in group ${groupString})`); })
|
|
|
|
+ .catch(error => { logger.error(`error accepting friend request from ${userString}, error: ${error}`); })
|
|
|
|
+ .then(() => true);
|
|
}).catch(() => false)))).then(done => {
|
|
}).catch(() => false)))).then(done => {
|
|
if (done)
|
|
if (done)
|
|
return;
|
|
return;
|
|
@@ -157,8 +159,9 @@ class default_1 {
|
|
logger.debug(`detected group invitation event: ${groupString}}`);
|
|
logger.debug(`detected group invitation event: ${groupString}}`);
|
|
return session.bot.getFriendList().then(friendList => {
|
|
return session.bot.getFriendList().then(friendList => {
|
|
if (friendList.some(friendItem => friendItem.userId = session.userId)) {
|
|
if (friendList.some(friendItem => friendItem.userId = session.userId)) {
|
|
- session.bot.handleGroupRequest(session.messageId, true);
|
|
|
|
- return logger.info(`accepted group invitation from ${userString} (friend)`);
|
|
|
|
|
|
+ return session.bot.handleGroupRequest(session.messageId, true)
|
|
|
|
+ .then(() => { logger.info(`accepted group invitation from ${userString} (friend)`); })
|
|
|
|
+ .catch(error => { logger.error(`error accepting group invitation from ${userString}, error: ${error}`); });
|
|
}
|
|
}
|
|
logger.warn(`received group invitation from ${userString} (stranger)`);
|
|
logger.warn(`received group invitation from ${userString} (stranger)`);
|
|
logger.warn('please manually accept this group invitation');
|
|
logger.warn('please manually accept this group invitation');
|
|
@@ -167,7 +170,11 @@ class default_1 {
|
|
this.app.middleware((session) => __awaiter(this, void 0, void 0, function* () {
|
|
this.app.middleware((session) => __awaiter(this, void 0, void 0, function* () {
|
|
const chat = yield this.getChat(session);
|
|
const chat = yield this.getChat(session);
|
|
const cmdObj = command_1.parseCmd(session.content);
|
|
const cmdObj = command_1.parseCmd(session.content);
|
|
- const reply = (msg) => __awaiter(this, void 0, void 0, function* () { return session.sendQueued(msg); });
|
|
|
|
|
|
+ const reply = (msg) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
+ const userString = `${session.username}(${session.userId})`;
|
|
|
|
+ return session.sendQueued(msg)
|
|
|
|
+ .catch(error => { logger.error(`error replying to message from ${userString}, error: ${error}`); });
|
|
|
|
+ });
|
|
switch (cmdObj.cmd) {
|
|
switch (cmdObj.cmd) {
|
|
case 'twitter_view':
|
|
case 'twitter_view':
|
|
case 'twitter_get':
|
|
case 'twitter_get':
|