seclaw 0.1.12 → 0.1.13
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/runtime/agent.js +22 -5
- package/package.json +1 -1
package/dist/runtime/agent.js
CHANGED
|
@@ -2102,8 +2102,7 @@ Mode: *${modeLabel}*`;
|
|
|
2102
2102
|
if (notInstalled.length > 0) {
|
|
2103
2103
|
text += `
|
|
2104
2104
|
|
|
2105
|
-
|
|
2106
|
-
_Tap to view details:_`;
|
|
2105
|
+
${notInstalled.length} more available:`;
|
|
2107
2106
|
}
|
|
2108
2107
|
const keyboard = [];
|
|
2109
2108
|
if (capabilities.length >= 2) {
|
|
@@ -2121,7 +2120,7 @@ _Tap to view details:_`;
|
|
|
2121
2120
|
}
|
|
2122
2121
|
for (const t of notInstalled) {
|
|
2123
2122
|
keyboard.push([{
|
|
2124
|
-
text: `${t.name} \u2014
|
|
2123
|
+
text: `${t.name} \u2014 Details`,
|
|
2125
2124
|
url: `https://seclawai.com/templates/${t.id}`
|
|
2126
2125
|
}]);
|
|
2127
2126
|
}
|
|
@@ -2144,7 +2143,7 @@ async function handleSwitchCallback(chatId, msgId, capId, config2) {
|
|
|
2144
2143
|
async function sendMessageWithButtons(token, chatId, text, keyboard) {
|
|
2145
2144
|
if (!token || !chatId) return;
|
|
2146
2145
|
try {
|
|
2147
|
-
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
|
|
2146
|
+
const res = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
|
|
2148
2147
|
method: "POST",
|
|
2149
2148
|
headers: { "Content-Type": "application/json" },
|
|
2150
2149
|
body: JSON.stringify({
|
|
@@ -2154,7 +2153,25 @@ async function sendMessageWithButtons(token, chatId, text, keyboard) {
|
|
|
2154
2153
|
reply_markup: { inline_keyboard: keyboard }
|
|
2155
2154
|
})
|
|
2156
2155
|
});
|
|
2157
|
-
|
|
2156
|
+
const data = await res.json();
|
|
2157
|
+
if (!data.ok) {
|
|
2158
|
+
console.log(`[telegram] Markdown failed (buttons): ${data.description} \u2014 retrying plain`);
|
|
2159
|
+
const retryRes = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
|
|
2160
|
+
method: "POST",
|
|
2161
|
+
headers: { "Content-Type": "application/json" },
|
|
2162
|
+
body: JSON.stringify({
|
|
2163
|
+
chat_id: chatId,
|
|
2164
|
+
text,
|
|
2165
|
+
reply_markup: { inline_keyboard: keyboard }
|
|
2166
|
+
})
|
|
2167
|
+
});
|
|
2168
|
+
const retryData = await retryRes.json();
|
|
2169
|
+
if (!retryData.ok) {
|
|
2170
|
+
console.error(`[telegram] Plain also failed (buttons): ${retryData.description}`);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
} catch (err) {
|
|
2174
|
+
console.error(`[telegram] sendMessageWithButtons error:`, err.message);
|
|
2158
2175
|
try {
|
|
2159
2176
|
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
|
|
2160
2177
|
method: "POST",
|