Skip to content

Commit 41ac508

Browse files
committed
refactor(GeneralCommands.ts) to import and use botMessages.json correctly"
1 parent 1e0cece commit 41ac508

2 files changed

Lines changed: 8 additions & 17 deletions

File tree

src/bot/commands/genearl/GeneralCommands.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Context } from 'grammy';
22
import { Catch } from '../../../decorators/Catch';
33
import { BotReply } from '../../../utils/chat/BotReply';
4-
import { help, start, commands } from '../../../utils/jsons/botMessages.json';
4+
import * as botMessages from '../../../utils/jsons/botMessages.json';
55
import { ChatInfo } from '../../../utils/chat/ChatInfo';
66
import { DateCommand } from '../../service/general/date';
77
import * as BotInfoJson from '../../../../docs/BotInfo.json';
@@ -18,20 +18,21 @@ import * as BotInfoJson from '../../../../docs/BotInfo.json';
1818
* Code for handling case-insensitivity bot/bot.ts
1919
*/
2020
export class GeneralCommands {
21+
@Catch()
2122
static getMessage(ctx: Context): { commands: string; help: string; start: string } {
2223
const chatInfo = new ChatInfo(ctx);
2324
const chattype = chatInfo.getChatType();
2425
if (chattype === 'private') {
2526
return {
26-
help: help.general,
27-
commands: commands.private,
28-
start: start.Private,
27+
help: botMessages.help.general,
28+
commands: botMessages.commands.private,
29+
start: botMessages.start.Private,
2930
};
3031
}
3132
return {
32-
commands: commands.public,
33-
help: help.general,
34-
start: start.gorup,
33+
commands: botMessages.commands.public,
34+
help: botMessages.help.general,
35+
start: botMessages.start.gorup,
3536
};
3637
}
3738
// === General Command Handlers ===

src/utils/jsons/botMessages.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
{
22
"gorup": {
3-
"user": {
4-
"ban": {
5-
"banned": "",
6-
"un_ban": "",
7-
"ban_use_blacklist_message": ""
8-
},
9-
"mute": "",
10-
"warn": ""
11-
},
12-
"join_to_new_group": "",
133
"new_member_welcome": "Welcome to the group, {name}! Please introduce yourself."
144
},
155
"command": {

0 commit comments

Comments
 (0)