@izhimu/qq 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/src/channel.js +16 -16
  2. package/package.json +1 -1
@@ -141,7 +141,8 @@ export const qqPlugin = {
141
141
  // 检查是否已存在连接
142
142
  const existingConnection = getConnection();
143
143
  if (existingConnection) {
144
- await stopAccount();
144
+ log.warn('gateway', `A connection is already running`);
145
+ return;
145
146
  }
146
147
  // Create new connection manager
147
148
  const connection = new ConnectionManager(account);
@@ -195,23 +196,22 @@ export const qqPlugin = {
195
196
  throw error;
196
197
  }
197
198
  },
198
- stopAccount,
199
+ stopAccount: async (_ctx) => {
200
+ const connection = getConnection();
201
+ if (connection) {
202
+ await connection.stop();
203
+ clearConnection();
204
+ }
205
+ setContextStatus({
206
+ running: false,
207
+ linked: false,
208
+ connected: false,
209
+ lastStopAt: Date.now(),
210
+ });
211
+ clearContext();
212
+ },
199
213
  }
200
214
  };
201
- async function stopAccount() {
202
- const connection = getConnection();
203
- if (connection) {
204
- await connection.stop();
205
- clearConnection();
206
- }
207
- setContextStatus({
208
- running: false,
209
- linked: false,
210
- connected: false,
211
- lastStopAt: Date.now(),
212
- });
213
- clearContext();
214
- }
215
215
  async function outboundSend(ctx) {
216
216
  const { to, text, mediaUrl, accountId, replyToId } = ctx;
217
217
  log.debug("outbound", `send called - accountId: ${accountId}, to: ${to}, mediaUrl: ${mediaUrl ?? "null"}, replyToId: ${replyToId ?? "none"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izhimu/qq",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A QQ channel plugin for OpenClaw using NapCat WebSocket",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",