weixin-mcp 1.7.5 → 1.7.6
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.
- package/dist/messaging.js +5 -1
- package/package.json +1 -1
- package/src/messaging.ts +6 -1
package/dist/messaging.js
CHANGED
|
@@ -96,6 +96,9 @@ export async function cliSend(args) {
|
|
|
96
96
|
if (resolvedTo !== opts.to)
|
|
97
97
|
console.log(`Resolved "${opts.to}" → ${resolvedTo}`);
|
|
98
98
|
const { token, baseUrl = DEFAULT_BASE_URL } = loadAccount();
|
|
99
|
+
// Get contextToken from contacts (required for sending)
|
|
100
|
+
const contacts = loadContacts();
|
|
101
|
+
const contextToken = contacts[resolvedTo]?.contextToken;
|
|
99
102
|
// Determine what to send
|
|
100
103
|
const mediaPath = opts.image || opts.file || opts.video;
|
|
101
104
|
const mediaType = opts.image ? "image" : opts.file ? "file" : opts.video ? "video" : null;
|
|
@@ -122,13 +125,14 @@ export async function cliSend(args) {
|
|
|
122
125
|
caption: opts.caption,
|
|
123
126
|
token: token,
|
|
124
127
|
baseUrl,
|
|
128
|
+
contextToken,
|
|
125
129
|
});
|
|
126
130
|
console.log("✅ Sent");
|
|
127
131
|
}
|
|
128
132
|
else if (opts.text) {
|
|
129
133
|
// Text message
|
|
130
134
|
process.stdout.write(`Sending to ${resolvedTo}... `);
|
|
131
|
-
const result = await sendTextMessage(resolvedTo, opts.text, token, baseUrl);
|
|
135
|
+
const result = await sendTextMessage(resolvedTo, opts.text, token, baseUrl, contextToken);
|
|
132
136
|
const ret = result?.ret ?? result?.errcode;
|
|
133
137
|
if (ret === 0 || ret === undefined) {
|
|
134
138
|
console.log("✅ Sent");
|
package/package.json
CHANGED
package/src/messaging.ts
CHANGED
|
@@ -114,6 +114,10 @@ export async function cliSend(args: string[]) {
|
|
|
114
114
|
if (resolvedTo !== opts.to) console.log(`Resolved "${opts.to}" → ${resolvedTo}`);
|
|
115
115
|
const { token, baseUrl = DEFAULT_BASE_URL } = loadAccount();
|
|
116
116
|
|
|
117
|
+
// Get contextToken from contacts (required for sending)
|
|
118
|
+
const contacts = loadContacts();
|
|
119
|
+
const contextToken = contacts[resolvedTo]?.contextToken;
|
|
120
|
+
|
|
117
121
|
// Determine what to send
|
|
118
122
|
const mediaPath = opts.image || opts.file || opts.video;
|
|
119
123
|
const mediaType: MediaType | null = opts.image ? "image" : opts.file ? "file" : opts.video ? "video" : null;
|
|
@@ -143,12 +147,13 @@ export async function cliSend(args: string[]) {
|
|
|
143
147
|
caption: opts.caption,
|
|
144
148
|
token: token!,
|
|
145
149
|
baseUrl,
|
|
150
|
+
contextToken,
|
|
146
151
|
});
|
|
147
152
|
console.log("✅ Sent");
|
|
148
153
|
} else if (opts.text) {
|
|
149
154
|
// Text message
|
|
150
155
|
process.stdout.write(`Sending to ${resolvedTo}... `);
|
|
151
|
-
const result = await sendTextMessage(resolvedTo, opts.text, token!, baseUrl) as Record<string, unknown>;
|
|
156
|
+
const result = await sendTextMessage(resolvedTo, opts.text, token!, baseUrl, contextToken) as Record<string, unknown>;
|
|
152
157
|
const ret = result?.ret ?? result?.errcode;
|
|
153
158
|
if (ret === 0 || ret === undefined) {
|
|
154
159
|
console.log("✅ Sent");
|