Skip to content

Commit

Permalink
fix error on cmd execution
Browse files Browse the repository at this point in the history
  • Loading branch information
melod1n committed Oct 1, 2024
1 parent 89e9c02 commit 28c39c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/commands/cmd.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Command, Requirement, Requirements} from "../model/chat-command";
import {Utils} from "../util/utils";
import {Api} from "../api/api";
import { Command, Requirement, Requirements } from "../model/chat-command";
import { Utils } from "../util/utils";
import { Api } from "../api/api";
import { MessageContext, ContextDefaultState } from "vk-io";

export class Cmd extends Command {
Expand All @@ -14,7 +14,13 @@ export class Cmd extends Command {
async execute(context: MessageContext<ContextDefaultState>, params: any[]) {
const text = params[1];

const result = await Utils.executeCommand(text);
await Api.sendMessage(context, result);
Utils
.executeCommand(text)
.then(async (r) => await Api.sendMessage(context, r))
.catch(async (e) => {
console.error(e);
await Api.sendMessage(context, "Произошла ошибка");
}
);
}
}
2 changes: 1 addition & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const BOT_VERSION = "0.0.5";
export const BOT_VERSION = "0.0.6";

0 comments on commit 28c39c8

Please sign in to comment.