Skip to content

Commit 9f388c7

Browse files
committed
refactor: app.ts, remove Membership.ts, and update tsconfig.json
1 parent b51906f commit 9f388c7

File tree

3 files changed

+8
-42
lines changed

3 files changed

+8
-42
lines changed

src/app.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,14 @@ const logger = new Logger({
2121
const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
2222
new GenerateCommand(bot).generate();
2323
bot.on("message", async (ctx) => {
24-
await MessageCheck.CheckBlackList(ctx);
24+
if (!ctx.chat) {
25+
return;
26+
}
27+
await MessageCheck.isCode(ctx);
2528
await Spam.WarnSpam(ctx);
26-
if (ctx.message?.new_chat_members?.length! > 0) {
27-
const users = ctx.message?.new_chat_members!;
28-
for (const user of users) {
29-
if (user.id !== ctx.me?.id) {
30-
const username = user.username ? `@${user.username}` : user.first_name;
31-
await ctx.reply(
32-
`Dear ${username}, welcome to ${ctx.chat.title} chat ❤️`
33-
);
34-
}
35-
}
36-
}
29+
await MessageCheck.isNewUser(ctx);
30+
await MessageCheck.leftGroup(ctx);
31+
3732
});
3833
bot.on("my_chat_member", MessageCheck.initialGroup);
3934
(async () => {

src/service/db/group/Membership.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"rootDir": "src"
1515
},
1616
"exclude": ["node_modules"],
17-
"include": ["src/**/*.ts"]
17+
"include": ["src/**/*.ts", "src/types/index"]
1818
}

0 commit comments

Comments
 (0)