Prechádzať zdrojové kódy

Merge branch 'instagram' into stories

Mike L 3 rokov pred
rodič
commit
21d33e8dbc
3 zmenil súbory, kde vykonal 9 pridanie a 7 odobranie
  1. 4 3
      dist/koishi.js
  2. 4 3
      src/koishi.ts
  3. 1 1
      src/model.d.ts

+ 4 - 3
dist/koishi.js

@@ -67,6 +67,7 @@ class default_1 {
                                 chatID: {
                                     qq: Number(session.userId),
                                     group: Number(session.sender.groupId),
+                                    toString: () => session.userId,
                                 },
                                 chatType: "temp",
                             };
@@ -172,7 +173,7 @@ class default_1 {
                 const cmdObj = command_1.parseCmd(session.content);
                 const reply = (msg) => __awaiter(this, void 0, void 0, function* () {
                     const userString = `${session.username}(${session.userId})`;
-                    return session.sendQueued(msg)
+                    return (chat.chatType === "group" ? this.sendToGroup : this.sendToUser)(chat.chatID.toString(), msg)
                         .catch(error => { logger.error(`error replying to message from ${userString}, error: ${error}`); });
                 });
                 switch (cmdObj.cmd) {
@@ -196,8 +197,8 @@ class default_1 {
                         if (cmdObj.args.length === 0) {
                             reply(`Instagram 故事搬运机器人:
 /igstory - 查询当前聊天中的 Instagram Stories 动态订阅
-/igstory_subscribe〈链接|用户名〉- 订阅 Instagram Stories 搬运
-/igstory_unsubscribe〈链接|用户名〉- 退订 Instagram Stories 媒体搬运
+/igstory_sub[scribe]〈链接|用户名〉- 订阅 Instagram Stories 搬运
+/igstory_unsub[scribe]〈链接|用户名〉- 退订 Instagram Stories 媒体搬运
 /igstory_view〈链接|用户名〉- 查看该用户所有 Stories\
 ${chat.chatType === "temp" ?
                                 '\n(当前游客模式下无法使用订阅功能,请先添加本账号为好友。)' : ''}`);

+ 4 - 3
src/koishi.ts

@@ -78,6 +78,7 @@ export default class {
               chatID: {
                 qq: Number(session.userId),
                 group: Number(session.sender.groupId),
+                toString: () => session.userId,
               },
               chatType: ChatType.Temp,
             };
@@ -192,7 +193,7 @@ export default class {
       const cmdObj = parseCmd(session.content);
       const reply = async msg => {
         const userString = `${session.username}(${session.userId})`;
-        return session.sendQueued(msg)
+        return (chat.chatType === ChatType.Group ? this.sendToGroup : this.sendToUser)(chat.chatID.toString(), msg)
           .catch(error => { logger.error(`error replying to message from ${userString}, error: ${error}`); });
       };
       switch (cmdObj.cmd) {
@@ -216,8 +217,8 @@ export default class {
           if (cmdObj.args.length === 0) {
             reply(`Instagram 故事搬运机器人:
 /igstory - 查询当前聊天中的 Instagram Stories 动态订阅
-/igstory_subscribe〈链接|用户名〉- 订阅 Instagram Stories 搬运
-/igstory_unsubscribe〈链接|用户名〉- 退订 Instagram Stories 媒体搬运
+/igstory_sub[scribe]〈链接|用户名〉- 订阅 Instagram Stories 搬运
+/igstory_unsub[scribe]〈链接|用户名〉- 退订 Instagram Stories 媒体搬运
 /igstory_view〈链接|用户名〉- 查看该用户所有 Stories\
 ${chat.chatType === ChatType.Temp ?
     '\n(当前游客模式下无法使用订阅功能,请先添加本账号为好友。)' : ''

+ 1 - 1
src/model.d.ts

@@ -15,7 +15,7 @@ interface IGroupChat {
 }
 
 interface ITempChat {
-  chatID: {qq: number, group: number};
+  chatID: {qq: number, group: number, toString: () => string};
   chatType: ChatType.Temp;
 }