@grinev/opencode-telegram-bot 0.13.0 → 0.13.1
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.
|
@@ -19,9 +19,19 @@ const COMMANDS_CALLBACK_CANCEL = `${COMMANDS_CALLBACK_PREFIX}cancel`;
|
|
|
19
19
|
const COMMANDS_CALLBACK_EXECUTE = `${COMMANDS_CALLBACK_PREFIX}execute`;
|
|
20
20
|
const MAX_INLINE_BUTTON_LABEL_LENGTH = 64;
|
|
21
21
|
function formatExecutingCommandMessage(commandName, args) {
|
|
22
|
-
const
|
|
22
|
+
const prefix = t("commands.executing_prefix");
|
|
23
|
+
const commandText = `/${commandName}`;
|
|
23
24
|
const argsSuffix = args ? ` ${args}` : "";
|
|
24
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
text: `${prefix}\n${commandText}${argsSuffix}`,
|
|
27
|
+
entities: [
|
|
28
|
+
{
|
|
29
|
+
type: "code",
|
|
30
|
+
offset: prefix.length + 1,
|
|
31
|
+
length: commandText.length,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
25
35
|
}
|
|
26
36
|
export function buildCommandPageCallback(page) {
|
|
27
37
|
return `${COMMANDS_CALLBACK_PAGE_PREFIX}${page}`;
|
|
@@ -181,7 +191,10 @@ async function getCommandList(projectDirectory) {
|
|
|
181
191
|
throw error || new Error("No command data received");
|
|
182
192
|
}
|
|
183
193
|
return data
|
|
184
|
-
.filter((command) =>
|
|
194
|
+
.filter((command) => {
|
|
195
|
+
const source = command.source;
|
|
196
|
+
return (typeof command.name === "string" && command.name.trim().length > 0 && source === "command");
|
|
197
|
+
})
|
|
185
198
|
.map((command) => ({
|
|
186
199
|
name: command.name,
|
|
187
200
|
description: command.description,
|
|
@@ -252,7 +265,8 @@ async function executeCommand(ctx, deps, params) {
|
|
|
252
265
|
return;
|
|
253
266
|
}
|
|
254
267
|
const args = params.argumentsText.trim();
|
|
255
|
-
|
|
268
|
+
const executingMessage = formatExecutingCommandMessage(params.commandName, args);
|
|
269
|
+
await ctx.reply(executingMessage.text, { entities: executingMessage.entities });
|
|
256
270
|
const session = await ensureSessionForProject(ctx, params.projectDirectory);
|
|
257
271
|
if (!session) {
|
|
258
272
|
return;
|