Skip to content

Commit 047fff2

Browse files
committed
feat(helper): , added new commands, and refactored executeService function
1 parent da2d710 commit 047fff2

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/helper/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Context } from "grammy";
22
import { BotOverseer } from "../service/bot";
33
import { Logger } from "../config/logger";
4-
const logger = new Logger({ file: "error.log", level: "error" });
4+
const logger = new Logger({ file: "error.log", level: "error",timestampFormat:'locale' });
55

66
export async function handleError(
77
ctx: Context,
@@ -61,12 +61,10 @@ export const COMMANDS: string[] = [
6161
"date",
6262
"future",
6363
"rules",
64+
"approvedList",
65+
"shahin",
6466
];
65-
export async function executeService(
66-
ctx: Context,
67-
service: any,
68-
method: string
69-
) {
67+
export async function executeService(ctx: Context,service: any,method: string) {
7068
if (service[method]) {
7169
(await service[method](ctx)) || (await new service(ctx)[method]);
7270
} else {
@@ -91,8 +89,5 @@ export async function executeServiceAdmin(
9189
}
9290
} else {
9391
logger.error(`Action ${action} not found on service ${ServiceClass.name}`);
94-
await ctx.reply("There was an error processing your command.", {
95-
reply_to_message_id: ctx.message?.message_id,
96-
});
9792
}
9893
}

0 commit comments

Comments
 (0)